#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.misc
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.
--

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple functions, conditional functions HeatherBelle Excel Worksheet Functions 7 October 17th 08 03:57 PM
How to convert cell formula functions to code functions Adnan Excel Discussion (Misc queries) 1 October 1st 08 08:30 PM
efficiency: database functions vs. math functions vs. array formula nickname Excel Discussion (Misc queries) 2 July 14th 06 04:26 AM
Looking for a site with functions that substitute the ATP functions Franz Verga Excel Worksheet Functions 3 June 24th 06 04:30 AM
Nesting functions in the functions dialog box cs170a Excel Worksheet Functions 0 June 10th 05 10:36 PM


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"