# If(or ... statement not working

#### shapenote

##### Board Regular
I am have simple IF OR statement I am trying to do, but it's not working.

I have 2 columns of vlookups I did as two checks against employee numbers. So the vlookup is either returning their employee # or an #NA .

I am now trying to do an =if(or(e2>0,f2>0),True,False) formula. Basically saying if either of those columns return an actual number, then I want to say it meets my criteria as a valid employee.

Well, it's not working.

So, if in E I have an actual employee number, but in F, I am still getting #NA returned? Not sure why. I can clearly see it meets one of my conditions.

### Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

#### jtakw

##### Well-known Member
Hi,

Try this:

=IF(COUNT(E2:F2),TRUE,FALSE)

#### hicksi

##### Board Regular
#N/A isn't text or number. So it'll ALWAYS return an error condition.

=NOT(AND(ISERR(E2),ISERR(F2)))

Ie, if both are erroneous, you need a False

That one worked!

Thanks!

#### jtakw

##### Well-known Member
Assuming you're responding to my post # 2...

You're welcome.

@ hicksi, post # 3 formula will Always produce a TRUE result, as ISERR excludes #N/A errors, will need to use ISNA instead:

=NOT(AND(ISNA(E2),ISNA(F2)))

#### hicksi

##### Board Regular
OH ****... You're right.
I meant ISERROR.

I don't want to hijack shapenote's post, but I try to use ISERROR as my testing function, because it's usually all-encompassing.
My point is best shown by this example:-
Suppose the VLOOKUP functions were looking in the MANAGER's PAY SCALE columns and the STAFF PAY SCALE columns.
And suppose the PAY SCALE value was calculated each week as INCOME divided by HOURS WORKED.
Everything works wonderfully using ISNA until one of the employees goes on leave-without-pay. That results in a #DIV/0 error as the looked-up value.
ISERROR still returns the correct result. ISNA doesn't.

BTW...
=(COUNT(E2:F2)>0) also works, as the variant of your solution.

#### jtakw

##### Well-known Member
Well, you didn't use ISERROR, and for the OP's post, ISNA works just fine, and who's the MANAGER?, and what PAY SCALE?, and the rest ???

And, BTW, No need for the brackets in your post highlighted in red:

BTW...
=(COUNT(E2:F2)>0)also works, as the variant of your solution.

This will do just fine:

=COUNT(E2:F2)>0

Thank you for the feedback.

Last edited:

Replies
0
Views
193
Replies
5
Views
147
Replies
1
Views
385
Replies
4
Views
289
Replies
1
Views
214

1,195,855
Messages
6,011,973
Members
441,658
Latest member
Carlos O

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back