vlookup question

slindale

New Member
Joined
Aug 28, 2006
Messages
6
I am using vlookup (exact matcht) to retreive data from another spreadheet in the same workbook. Sometimes there will not be a match. How can I make excel return a value of zero if there is no match? I have been working on this for a long time. Any ideas would be greatly appreciated.

Thanks,
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
I'd wrap an if-statement around it.

Instead of:
=VLOOKUP(A2,lookup_rng,2,0)

Use something like:
=IF(COUNTIF(lookup_rng,A2)=0,0,VLOOKUP(A2,lookup_rng,2,0))

HTH
 

slindale

New Member
Joined
Aug 28, 2006
Messages
6
Thanks alot for the ideas. The countif worked great for me. Thanks everyone.
 

JamieDuncan

Board Regular
Joined
Aug 23, 2006
Messages
132
Using the COUNTIF statement is a better idea, the formula I made isnt exactly fullproof, VLOOKUP being the fickle beast it is.
 

Forum statistics

Threads
1,136,266
Messages
5,674,727
Members
419,523
Latest member
Urnovio

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top