If(or ... statement not working

shapenote

Board Regular
Joined
Jun 29, 2006
Messages
131
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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi,

Try this:

=IF(COUNT(E2:F2),TRUE,FALSE)
 
Upvote 0
#N/A isn't text or number. So it'll ALWAYS return an error condition.

Your test should be
=NOT(AND(ISERR(E2),ISERR(F2)))

Ie, if both are erroneous, you need a False
 
Upvote 0
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)))
 
Upvote 0
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.
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top