How do I test for a cell that contains a #N/A result from an Excel formula ?

Hi All,

I have a VLOOKUP formula in cell B6 which returns a value of #N/A. How can I test that cell (in another cell) for such an error ?

I've tried..

=IF(B6="#N/A",.........

but that doesn't work. How would I also test for this in VBA ?

Thanks in anticipation
Toco
TocogroupAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

[ fanpages ]IT Services ConsultantCommented:
Hi Toco,

You can use this:

=IF(ISNA(B6), "Is #N/A", "Is not #N/A")

Other "IS" functions, for your information:

ISBLANK
ISERR
ISERROR
ISEVEN
ISLOGICAL
(ISNA)
ISNONTEXT
ISNUMBER
ISODD
ISPMT <- Although, not quite as useful as the others summarised here in this circumstance!
ISREF
ISTEXT

BFN,

fp.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveCommented:
you can use the function ISNA()

And in VBA you can use application.worksheetfunction.isna()

There are also functions such as ISERROR or IFERROR for handling error results.
0
Shanan212Commented:
You can start something like this


=IFERROR(B2,

so

=IFERROR(B2, "ERROR FOUND")

Open in new window


This would work for any error, not just "#N/A"
0
TocogroupAuthor Commented:
Thanks everyone for your quick responses.

fp, as you were first out of the blocks I'll award you the points.
Thanks again
Toco
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.