MrExcel Publishing
Your One Stop for Excel Tips & Solutions

if statement with multiple conditions


Posted by Blind Ric on January 17, 2001 12:04 PM

I have a number in cells A1 through L1. I am trying to put in a formula into cell B3 that checks the content of cell A3. If A3 equals any of the numbers in cells A1 through L1, it will put the word yes, and it will put the word no otherwise. I tried a huge embedded netwrok of if statements, but it did not work. Anyone have any ideas? Thanks.

Posted by Steve Riedmueller on January 17, 2001 12:24 PM

Look into the "For Each .. in .." structure... it might be what you need.

Posted by Aladin Akyurek on January 17, 2001 12:56 PM

I hope I got your question right.

B3 =IF(COUNTIF(A1:A5,A3)>=2,"Yes","No")

Aladin

Posted by Bruce on January 17, 2001 12:59 PM

Try this formula:

=IF(ISNA(HLOOKUP(A3,A1:L1,1,FALSE)),"No","Yes")

Posted by Aladin Akyurek on January 17, 2001 1:00 PM

Gone too fast: Change the formula to:

B3 =IF(COUNTIF(A1:L1,A3)>=1,"Yes","No")

Aladin

Posted by Mark W. on January 17, 2001 1:34 PM

{=IF(OR(A3=A1:L1),"Yes","No")}