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))
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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.....
 

Watch MrExcel Video

Forum statistics

Threads
1,119,129
Messages
5,576,263
Members
412,710
Latest member
Maged elmasry
Top