View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Chris Premo Chris Premo is offline
external usenet poster
 
Posts: 37
Default AND & OR Functions

As the two previous posts show there are multiple ways of writing you
IF statement. The hardest thing to do is determining which way to
write the argument. Depending on how it is written/stated, you may not
get the results you want.

In the first example, "=IF(AND(B1=5,OR(B2=10,B2=20),TRUE,FALSE)" you
will get a true response when the combination of the cells B1 and B2
match the AND parameter (5 and 10 or 5 and 20). Otherwise, you will
get a FALSE response.


If we were to take the same statement and reverse the AND and OR
arguments "=IF(OR(B1=5,AND(B2=10,B2=20),TRUE,FALSE)" you will get a
true response if cell B1 = 5. The AND argument is invalid since both
AND cells are the same. This is an circular formula.


In the second example, "=IF(OR(AND(A1=1,A2=2),B3=3)" you will get a
TRUE response if A1=1 and A2=2 regardless of the value of B3 or if B3=3
regardless of the value of A1 and A2.

Again, if we reverse the arguments "=IF(AND(OR(A1=1,A2=2),B3=3)" then
the results will change. In this instance if B3=3 and (A1=1 or A2=2)
then you would get a TRUE result. Otherwise you would get a FALSE.
Changing the position of the AND or OR arguments has no baring on the
validity of the formula.
--