Using IF Formula for Vlookup


G

Geoff

Hi

I am using Vlookup formula refering to a 2 column table of which the left is
a code and the right colmn is the amount. if the code is not found I want it
to come up zero rather than N/A, so if the table is updated in future with
different codes it will still come up correctly. Maybe it can highlight the
cell a different colour if it cannot find that code in the table?
 
Ad

Advertisements

S

Stefi

In Excel2003:
=IF(ISERROR(VLOOKUP(yourarguments)),"",VLOOKUP(yourarguments))
In Excel2007 there is a more compact solution.

For highlighting apply
=ISERROR(VLOOKUP(yourarguments)) as conditional formatting formula!

Regards,
Stefi

„Geoff†ezt írta:
 
G

Geoff

Thanks

the value is coming up "TRUE" rather than zero.

Is there a way of excel putting zero instead.
Cheers
 
S

Stefi

=IF(ISERROR(VLOOKUP(yourarguments)),0,VLOOKUP(yourarguments))
This version returns 0 if code is not found.
For highlighting
=ISERROR(VLOOKUP(yourarguments)) returns TRUE if code is not found as
required in conditional formatting.

Stefi


„Geoff†ezt írta:
 
D

David Biddulph

I think that for Excel 2007, Stefi intended to suggest
=IFERROR(VLOOKUP(yourarguments),"") as an alternative to Excel 2003's
=IF(ISERROR(VLOOKUP(yourarguments)),"",VLOOKUP(yourarguments))

If you want a zero as the result in the error condition, replace "" in the
formula by 0.
 
Ad

Advertisements

G

Geoff

Thanks very helpful


David Biddulph said:
I think that for Excel 2007, Stefi intended to suggest
=IFERROR(VLOOKUP(yourarguments),"") as an alternative to Excel 2003's
=IF(ISERROR(VLOOKUP(yourarguments)),"",VLOOKUP(yourarguments))

If you want a zero as the result in the error condition, replace "" in the
formula by 0.
 
Ad

Advertisements


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