IF(OR Statement in Excel

I am having a problem with the if(Or statement in Excel

I am trying to assign the value of "1" to a column B  if column Z is equal to "FE" or "GE" or "HE" or "IE"   and a value of "0" if it is not.

This statement is giving me a "0" at all times.   What is the correct code.

=IF(OR(Z29="FE",Z29="GE",Z29="HE",Z29="IE"),1,0)
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?
 
Rory ArchibaldConnect With a Mentor Commented:
That is correct, though you can simplify it to:

=IF(OR(Z29={"FE","GE","HE","IE"}),1,0)

are you sure you don't have any leading or trailing spaces in the cells you are checking, for example?
0
 
moriniaAdvanced Analytics AnalystAuthor Commented:
Thanks for the shorter version,  My formula did work, it just had not finished calculating.
0
All Courses

From novice to tech pro — start learning today.