Return a 0 when vlookup returns #n/a

B

brian.baker13

Hi

I am doing a vlookup on cell a12 which looks up the entry from a12 in
another tab. When the info from cell a12 is not in the other tab
reference I am looking up I get a #n/a error. I would like to return a
zero or a blank when the lookup does not return a match from cell a12

=VLOOKUP($A12,Sheet2!$D$15:$N$244,B$3,0)

Please help.

Regards

Brian
 
P

Pete_UK

Hi Brian, try it this way:

=IF(ISNA(VLOOKUP($A12,Sheet2!$D$15:$N$244,B
$3,0)),"",VLOOKUP($A12,Sheet2!$D$15:$N$244,B$3,0))

You can change the "" in the middle to 0 if you prefer that.

Hope this helps.

Pete
 
D

Dave Peterson

=if(isna(vlookup(...)),"",if(vlookup(...)="","",vlookup(...))))

or

=if(iserror(1/len(vlookup(...)),"",vlookup(...))
 

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

Top