VLookup

F

Fitzi

I am using the vlookup function. I want it to look up an exact match then
return the number zero if it does not find a match instead of #N/A.

Can you help?
 
O

OssieMac

Hi Fitzi,

=IF(ISNA(VLOOKUP(C2,$A$2:$B$20,2,FALSE)),"",VLOOKUP(C2,A2:B20,2,FALSE))


Not above is one line if it should break when posted.

Assumes:
C2 is the Lookup Value
A2:B20 is the table array

If lookup returns #N/A the a null ("") is used in lieu.
 
O

OssieMac

Hi again,

My apologies. So used to returning null if not found I did it in the
formula. Should be following to return zero if not found:

=IF(ISNA(VLOOKUP(C2,$A$2:$B$20,2,FALSE)),0,VLOOKUP(C2,A2:B20,2,FALSE))
 
G

Gord Dibben

And don't forget to make the second lookup table absolute also.

=IF(ISNA(VLOOKUP(C2,$A$2:$B$20,2,FALSE)),0,VLOOKUP(C2,$A$2:$B$20,2,FALSE))


Gord Dibben MS Excel MVP
 
O

OssieMac

Thanks for correcting that Gord. What would we do without observant people
like yourself looking over our shoulder and fixing our mistakes?
 

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