mercredi 5 août 2015

Excel multiple nested if and or conditions repeated multiple times

I am trying to create multiple if and or conditions in one cell so that if they are true the cell value changes.

(In case this is relevant when you read the code I tried, I am referencing this information from a separate spreadsheet. Also, some translating: si=if, ou=or. Suggestions with English functions are totally fine though.)

My aim is to for a "1" numerical value to come back if (1) c3="VSTM", (2) j3="i", (3) if b3="1" or "3" and if i3 = 1 or 4 then value of cell becomes 1; if b3="2" or "4" and if i3 = 2 or 3 then value of cell becomes 1.

Finally h3 value is simply added to the final value from the if conditions.

I tried the following but it didn't work:

=si([Coded_Diary_Results2.xlsx]Feuil1!$C$3="VSTM",si([Coded_Diary_Results2.xlsx]Feuil1!$J$3="i",si([Coded_Diary_Results2.xlsx]Feuil1!$B$3="1",si(ou([Coded_Diary_Results2.xlsx]Feuil1!$I$3="1","4")))))=1

One problem still is even after I get this to work, I then want a kind of loop to exist which still checks b3 and c3 as normal but after checking i3 and j3 it now moves 7 columns down to check p3 (instead of i3) and q3 (instead of j3) for the same information with p3 checking for numbers 2 and 3, or 1 and 4 based on b3, whilst q will still search for only "i" as the value in the cell. I would like this loop to continue 16 times so then it checks cells w3 and x3, ad3 and ae3, ak3 and al3, ar3 and as etc.

Finally as an additional step, if possible but not necessary, after all the steps have been executed in row 3, it would be very useful if all the same steps can then be executed until row 69. For more information if this is useful, this data is from a study and each row is a participant so this is why the aim would be for all the steps to be repeated with all the participants (i.e., rows).

Any suggestions of whether it is possible to apply this idea and how my initial attempt could be improved or whether a totally different approach should be taken ?

Aucun commentaire:

Enregistrer un commentaire