Embedding an OR statement in an IF statement efficiently

C

Chatnoir11

Hi. I am doing a simple IF statement with an OR in it.

If(OR(B2="A",B2="B",B2="C"), "X","Y") but I have many more of the OR
criteria, so it takes a long time to type, lots of room for typos.

Is there a more efficient way where I can say, basically if B2 equals
anything in this list, then "X", otherwise "Y"? I tried a dozen variations
but kept getting the "VALUE" error.

Thanks! I do these a lot, so I'd like to speed it up...
 
G

Gary''s Student

Say you one hundred possible valid values for the IF. Rather than make a
super-long formula; list them in a column, say column Z from Z1 thru Z100.
And then:

=IF(COUNTIF(Z1:Z100,B2)>0,"X","Y")
 
D

Dave Peterson

=IF(OR(B2={"A","B","C"}),"X","Y")

Hi. I am doing a simple IF statement with an OR in it.

If(OR(B2="A",B2="B",B2="C"), "X","Y") but I have many more of the OR
criteria, so it takes a long time to type, lots of room for typos.

Is there a more efficient way where I can say, basically if B2 equals
anything in this list, then "X", otherwise "Y"? I tried a dozen variations
but kept getting the "VALUE" error.

Thanks! I do these a lot, so I'd like to speed it up...
 

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

Similar Threads


Top