Having "Or" in an If statement doesn't work?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?
 
I was trying this statement:

If a = 2 or b =2 then .....

But the b = 2 doesn't get tested for some reason, why is that?

It will work in VBA, but not in a cell formula. In a cell the format
is:

=IF(OR(A=2,B=2),[do if true],[do if false])

Mark Lincoln
 
Hi,

It's not clear from your question whether you are doing this in the
spreadsheet or in code.

IF in code:

IF a=2 OR b=2 then
...
End IF

or

IF a=2 XOR b=2 then
....
End IF

In the spreadsheet there is no XOR option you would need to make a more
complicated formula.
 
Back
Top