Using Excel error #N/A in a formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to capture the error message #N/A in an IF statement

Would like to use IF(MATCH(C1,Range,0)=#N/A,"OK","STOP") but it does not seem to work. What is the correct syntax to capture the #N/A error message and display "OK" instead of #N/A?
 
=IF(ISNA(MATCH(C1,Range,0)),"OK","STOP")

HTH
Jason
Atlanta, GA
-----Original Message-----
I would like to capture the error message #N/A in an IF statement.

Would like to use IF(MATCH(C1,Range,0)=#N/A,"OK","STOP")
but it does not seem to work. What is the correct syntax
to capture the #N/A error message and display "OK" instead
of #N/A?
 
=IF(ISNA(MATCH(C1,Range,0)),"OK","STOP")
but it does not seem to work. . . .

An alternative that avoids the whole issue:

=IF(COUNTIF(Range,C1),"STOP","OK")
 
Harlan Grove said:
...

An alternative that avoids the whole issue:

=IF(COUNTIF(Range,C1),"STOP","OK")

--

The problem with countif (as I experienced personally)
is that it doesn't differ between text numbers and numbers. Obviously it
will work if
the lookup value is a text string however if it is a number it can return
true while the vlookup
returns #N/A and that could be confusing.
i.e.

=COUNTIF(Range,"1")

return the same as

=COUNTIF(Range,1)

while

=VLOOKUP("1",Table,2,0)

and

=VLOOKUP(1,Table,2,0)

does not
 
...
The problem with countif (as I experienced personally)
is that it doesn't differ between text numbers and numbers. Obviously it ...
=COUNTIF(Range,"1")

return the same as

=COUNTIF(Range,1)

while

=VLOOKUP("1",Table,2,0)

and

=VLOOKUP(1,Table,2,0)

does not

Good point. An alternative would be SUMPRODUCT(--(Range=1)), which doesn't
suffer from this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

formula error 1
Formula returns #N/A 1
Formulas #N/A 4
Ignore #N/A in formula 3
#N/A 5
#N/A Conditional Formatting affects all cells? 9
Getting a MATCH error 1
The use of N/A in formulas 1

Back
Top