View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Embedding an OR statement in an IF statement efficiently

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")

--
Gary''s Student - gsnu200830


"Chatnoir11" wrote:

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...