vlookup returning 0 instead of blank

bucci35

Active Member
Joined
Jul 6, 2002
Messages
350
Office Version
  1. 365
Platform
  1. Windows
Hi,
I have the following formula that is returning a 0 when the item can be found but the second cell over is blank. I want it to return blank.

IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))

I want this to return a blank when the item in C7 can't be found PLUS if the item in C7 can be found but the second cell over is blank.
Any ideas what I'm doing wrong here??

Thanks,
dan
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
If the item is found but the second column is empty, that's not an error.

Maybe:

Code:
=IF(OR(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)=0),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))
 
Upvote 0
It isn't returning "" as there is no error, it's just found 0! Quickest fix is this:

IF(IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))=0,"",IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))

Sorry just typed this raw as I don't have a spreadsheet with these ranges but it should be ok...

Edit: jproffer 's formula is much simpler :)
 
Last edited:
Upvote 0
Hi,
I have the following formula that is returning a 0 when the item can be found but the second cell over is blank. I want it to return blank.

IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))

I want this to return a blank when the item in C7 can't be found PLUS if the item in C7 can be found but the second cell over is blank.
Any ideas what I'm doing wrong here??

Thanks,
dan
It will give you blank when VLOOKUP will error out i.e. won't find data.

At this point, it finds data alright but it does not have any value against the Data LOOKED UP!

You can make it look blank using
Format Cells | Custom and type 0;-0; and Apply. Or you will have to incorporate in the formula itself.
 
Upvote 0
This gets rid of the 0 return but now returns a TRUE word when in fact something is found in the second cell over??
 
Upvote 0
The above answer was in reference to symon's suggestion.
 
Upvote 0
Hi,
I have the following formula that is returning a 0 when the item can be found but the second cell over is blank. I want it to return blank.

IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))

I want this to return a blank when the item in C7 can't be found PLUS if the item in C7 can be found but the second cell over is blank.
Any ideas what I'm doing wrong here??

Thanks,
dan

Not very efficient...
Rich (BB code):
=IF(COUNTIF(Sheet2!$D$3:$D$5000,$C7),
    IF(VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0)="","",
       VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0)),
    "")

If VLOOKUP is supposed to return a text value...
Rich (BB code):
=IF(ISNA(VLOOKUP(VLOOKUP($C7,Sheet2!$D$3:$D$5000,1,0)),"",
    T(VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0))

If VLOOKUP is supposed to return a numeric value...
Rich (BB code):
=IF(ISNA(VLOOKUP(VLOOKUP($C7,Sheet2!$D$3:$D$5000,1,0)),"",
   IF(VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0)="","",
     VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0)))

If you are on Excel 2007 or later...
Rich (BB code):
=IFERROR(IF(VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0)="","",
   VLOOKUP($C7,Sheet2!$D$3:$H$5000,2,0)),"")
 
Upvote 0
This will happen when looking up data on another worksheet, if the cell is empty.
The answer is to check the length of the cell.
I have not tested it but expect it to be something like:
If(len(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0))=0,"",VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0))
 
Upvote 0
Hi,
I have the following formula that is returning a 0 when the item can be found but the second cell over is blank. I want it to return blank.

IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))

I want this to return a blank when the item in C7 can't be found PLUS if the item in C7 can be found but the second cell over is blank.
Any ideas what I'm doing wrong here??

Thanks,
dan
What version of Excel are you using?

What type of data does the formula normally return? Is it text? Numbers? Could be both?
 
Upvote 0
Really? I just replicated the tables and this works ok for me:

=IF(IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0)))=0,"",IF(ISERROR(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,)),"",(VLOOKUP(C7,Sheet2!$D$3:$H$5000,2,0))))

Not sure if it's identical to my original typed version to be fair, but in all honesty jproffers method is definitely the most efficient if mine doesnt work.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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
Back
Top