IF _ AND _ OR

O

oldjay

I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""
 
S

smartin

oldjay said:
I give up. I can't get the correct formula

If A1 =1 And A2 OR A3 =2 then A4 =4 otherwise A4 =""

Do be careful how you explain logical conundrums.

Strictly speaking, your question should be parsed as

If (A1 =1 And A2) OR A3 =2 then A4 =4 otherwise A4 =""

because AND takes precedence over OR.

Somehow I think you really meant

If A1 =1 And (A2 =2 OR A3 =2) then A4 =4 otherwise A4 =""

In which case I would write in A4:
 
S

smartin

smartin said:
Do be careful how you explain logical conundrums.

Strictly speaking, your question should be parsed as

If (A1 =1 And A2) OR A3 =2 then A4 =4 otherwise A4 =""

because AND takes precedence over OR.

Somehow I think you really meant

If A1 =1 And (A2 =2 OR A3 =2) then A4 =4 otherwise A4 =""

In which case I would write in A4:

=IF(AND(A1=1,OR(A2=2,A3=2)),4,"")

Sorry about the cliff-hanger!
 
D

David Biddulph

Perhaps you could explain to us what the AND function does for you in that
formula?
In what way does 1*AND(A=2) differ from 1*(A=2) ?
 
Top