using "or" in functions

  • Thread starter Thread starter Amy
  • Start date Start date
A

Amy

Does anyone know if excel has the ability to us or in an
if than statement?

For example: If cell B:3 is 4 or 9 or 11 I would like
it to return a certain value. If it is any other number
return another value.

I would appreciate any help anyone could give.
Thanks
 
=IF(OR(B3=4,B3=9,B3=11),value1,value2)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
You can use OR in an IF statement like

=IF(OR(B3=4,B4=9,B3=11),"certain value","nope")
 
Boolean operations are done using functions in Excel; OR(), AND(), NOT(),
etc. It's a little awkward but it works.

Dave
 
Hi Amy!

Just a word of explanation.

The condition of an IF function must evaluate to TRUE or FALSE.

If you use:

=OR(A1=5,B1=6)
you'll see that it evaluates to TRUE or false and can be used in that
form in an IF function

=IF(OR(A1=5,B1=6),"Either Condition Applies","No Condition Applies")

The same goes for the AND function.

If in doubt as to whether a condition is acceptable you can always
test it first.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
Back
Top