vlookup - can't find match

T

Tami

if i have a vlookup and it doesn't find a match and the data is not sorted in
ascending order, how do i get it to return a 0 instead of N/A or the closest
value?

assume somthing simple like: =VLOOKUP(A4,Sheet1!A5:C21,3)
 
R

Roger Govier

Hi Tami

Add the 4th optional parameter of Vlookup of False or 0
=VLOOKUP(A4,Sheet1!A5:C21,3,0)
this will force an exact Match.

To avoid the #N/A error, when the lookup value is not found, try
=IF(COUNTIF(Sheet1!A1:A23,A4),VLOOKUP(A4,Sheet1!A5:C21,3,0),0)
or, the slightly longer
=IF(ISNA(VLOOKUP(A4,Sheet1!A5:C21,3,0)),0,VLOOKUP(A4,Sheet1!A5:C21,3,0))
 

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


Top