Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
AND & OR Functions
I would like to combine AND and OR in an IF statement. What is the code? For
example, IF(......AND(a1=1, a2=2) OR(a3-"Yes",a4<0). Thanks |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
AND & OR Functions
=IF(OR(AND(A1=1,A2=2),B3=3),"do this if true","do something else if false")
in this example, if both A1 has the value of 1 and a2 has the value of 2, or if just B3 has the value of 3), then the argument is true, else....not true. "John P." wrote: I would like to combine AND and OR in an IF statement. What is the code? For example, IF(......AND(a1=1, a2=2) OR(a3-"Yes",a4<0). Thanks |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
AND & OR Functions
Lets say you want to know if B1 =5 and B2 = 10 or 20
=IF(AND(B1=5,OR(B2=10,B2=20),TRUE,FALSE) Hopefully that provides some guidance. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "John P." wrote: I would like to combine AND and OR in an IF statement. What is the code? For example, IF(......AND(a1=1, a2=2) OR(a3-"Yes",a4<0). Thanks |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
AND & OR Functions
"Jonathan Cooper" wrote: =IF(OR(AND(A1=1,A2=2),B3=3),"do this if true","do something else if false") in this example, if both A1 has the value of 1 and a2 has the value of 2, or if just B3 has the value of 3), then the argument is true, else....not true. "John P." wrote: I would like to combine AND and OR in an IF statement. What is the code? For example, IF(......AND(a1=1, a2=2) OR(a3-"Yes",a4<0). Thanks Very helpful and quick. Thanks for your attention. |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
AND & OR Functions
Thanks for your help and qick response. JJP
"Luke M" wrote: Lets say you want to know if B1 =5 and B2 = 10 or 20 =IF(AND(B1=5,OR(B2=10,B2=20),TRUE,FALSE) Hopefully that provides some guidance. -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "John P." wrote: I would like to combine AND and OR in an IF statement. What is the code? For example, IF(......AND(a1=1, a2=2) OR(a3-"Yes",a4<0). Thanks |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
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. -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple functions, conditional functions | Excel Worksheet Functions | |||
How to convert cell formula functions to code functions | Excel Discussion (Misc queries) | |||
efficiency: database functions vs. math functions vs. array formula | Excel Discussion (Misc queries) | |||
Looking for a site with functions that substitute the ATP functions | Excel Worksheet Functions | |||
Nesting functions in the functions dialog box | Excel Worksheet Functions |