Include several choices in an IF statement.

K

kevin

Once again thanks for your help folks. Could someone show me how to write the
following if statement. =IF(A1=RED OR BLUE OR GREEN OR BLACK OR ORANGE,1,0)
I know these would all need to be in "" but I am not sure what separator to
use.
 
R

RagDyer

Try this:

=IF(OR(A1={"RED","BLUE","GREEN","BLACK","ORANGE"}),1,0)

I'm sure you're talking Text here, and *not* the actual colors of the cell.
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================

Once again thanks for your help folks. Could someone show me how to write
the
following if statement. =IF(A1=RED OR BLUE OR GREEN OR BLACK OR ORANGE,1,0)
I know these would all need to be in "" but I am not sure what separator to
use.
 
K

kevin

Thanks very much, and yes I was talking about text. Thanks again for your help.
Kevin
 
K

kevin

One more complication, when using this formula in say cell d1, and if there
is no value in a1 it returns a 0 in d1, is there a way to include an (ifblank
, return a blank,) statement in the formula so that nothing appears in the
cell until an entry is made in the input cell. Just so that there is not a
long string of 0's.

Thanks Kevin
 
R

RagDyeR

Just replace the last 0 in the formula with a null ( "" ).

=IF(OR(A1={"RED","BLUE","GREEN","BLACK","ORANGE"}),1,"")
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


One more complication, when using this formula in say cell d1, and if there
is no value in a1 it returns a 0 in d1, is there a way to include an
(ifblank
, return a blank,) statement in the formula so that nothing appears in the
cell until an entry is made in the input cell. Just so that there is not a
long string of 0's.

Thanks Kevin
 
K

kevin

Thanks very much RagDyeR.

Kevin

RagDyeR said:
Just replace the last 0 in the formula with a null ( "" ).

=IF(OR(A1={"RED","BLUE","GREEN","BLACK","ORANGE"}),1,"")
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


One more complication, when using this formula in say cell d1, and if there
is no value in a1 it returns a 0 in d1, is there a way to include an
(ifblank
, return a blank,) statement in the formula so that nothing appears in the
cell until an entry is made in the input cell. Just so that there is not a
long string of 0's.

Thanks Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top