Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Handling #N/A in a cell

Status
Not open for further replies.

PreacherUK

Technical User
Sep 26, 2002
156
0
0
NL
Hi all,

I have the following code in a series of cells

=INDEX(NewPrices!B:B,MATCH($A4,NewPrices!$A:$A,0))

This is looking up a value in a sheet based on an identifier. If the identifier is not in the 'look up' list it is returning a value of #N/A (quite correctly). Is there an accepted/preferred way of handling this error message? something along the lines of:

if(INDEX(NewPrices!B:B,MATCH($A4,NewPrices!$A:$A,0))=#N/A) then make cell =0

I'm sure there is, I'm just not familiar enough with the odd syntax :)

Any help would be greatly appreciated and richly rewarded in gold stars :)
 
Just an update:


the below seems to work


if(ISNA('Formula'),'OutPut Value')

Who'd have believed there was a function for the #N/A value? :)
 
Hi,

For your information, there's also
Code:
ISERR()
and
Code:
ISERROR()
which you may find useful in the future.

Code:
ISNA()
will only capture #N/A values and
Code:
ISERR()
will capture everything BUT #N/A.

Code:
ISERROR
is a 'catch all'.

Hope this helps.



Leigh Moore
Solutions 4 MS Office Ltd
 
Your on the right track. Just use the formula twice:

=IF(ISERROR(MATCH(5,A1:A20,0)),0,MATCH(5,A1:A20,0))

Once to check for the error and the second to insert the corect value incase there isn't any error. Just be sure to replace the error value with one that can't be a part of your solution set. In this case the match function returns 1 through the size of the array so 0 would be a valid error indicator. -1 would be another.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top