If and Vlookup

dneas

New Member
Joined
Mar 3, 2002
Messages
34
Do you have to use another value to get the formula to give you a "0" if the vlookup is not false?

=IF(VLOOKUP(B5,'[2004 PO''s.xls]PPV'!$A$5:$B$567,2,FALSE)="#N/A","0",VLOOKUP(B5,'[2004 PO"s.xls]PPV'!$A$5:$B$567,2,FALSE))
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
L

Legacy 51064

Guest
You have to have an answer for the entry. If you use "", the answe will be blank in the cell.
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
You're on the right track but you can't quite do it that way, try this

=IF(ISNA(VLOOKUP(B5,'[2004 PO''s.xls]PPV'!$A$5:$B$567,2,FALSE)),0,VLOOKUP(B5,'[2004 PO"s.xls]PPV'!$A$5:$B$567,2,FALSE))
 

dneas

New Member
Joined
Mar 3, 2002
Messages
34
When I use your formula with the ISNA the non-matches are OK but the matches still give a #n/a for some reason?
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825

ADVERTISEMENT

I'm not sure how that would happen, have you modified the formula at all, it should work as per this example
Book1
ABCDEF
3
4lookupresult
5bananas2lemons4
6grapes3bananas2
7lemons4grapefruit0
8kumquat5
9
Sheet1


Formula in E5 copied down column

=IF(ISNA(VLOOKUP(D5,$A$5:$B$567,2,0)),0,VLOOKUP(D5,$A$5:$B$567,2,0))
 

dneas

New Member
Joined
Mar 3, 2002
Messages
34
Thank you

It worked when I changed the first lookup to 0 and the second one to false.

Thank you very much for your help.

=IF(ISNA(VLOOKUP(B5,Sheet2!$B$2:$C$564,2,0)),0,VLOOKUP(Sheet1!B5,Sheet2!$B$2:$C$564,2,FALSE))
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
FALSE or 0 for the 4th Argument of a VLOOKUP should be equivalent, switching one for the other should make no difference....but I'm happy that you have it working.....
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,632
Messages
5,832,774
Members
430,167
Latest member
Gogogoben

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