IFERROR with ""&VLOOKUP returning nothing

RLCornish

New Member
Joined
Feb 11, 2014
Messages
42
Hello, hello. This is more a question of why does this work. I LOVE the fact it does but I've chatted with several Excel folks and no one in my personal circle can tell me why this works. I'm doing some VBA work for a colleague and I noticed she has a formula that reads:

=IFERROR(""""&VLOOKUP($B16,tbl_Status,2,0),"""")

I get the the whole piece about it returning the value from column 2 of tbl_Status if it finds B16 in tbl_Status. However, what it actually does if it doesn't find a match to B16 is what is fascinating to me. If it doesn't find it based on the end of the IFERROR I would expect a blank, but without the first part, """"&, it doesn't return a blank, it returns a 0. I don't know if this is relevant but the B16 this is referring to is a value in a pivot table.

Why does adding the """"& to this return a blank instead of a 0?

Curious minds want to know.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I will say I got super happy with the "'s when I was typing the formula above. It's only "" before the & and at the end, not """". Sorry about that! The formula actually is...

=IFERROR(""&VLOOKUP($B16,tbl_Status,2,0),"")
 
Last edited:
Upvote 0
Hi live_excel. Actually the formula works exactly as I want it to just the way it is. I was just trying to understand why with the "" before the & and at the end it brought back blanks instead of 0's. If I take the first part out, the ""&, it will return a value of 0. It even does that if I try the version you suggested, which thank you for that. I'm just baffled why the ""& makes it return a blank.
 
Upvote 0
However, what it actually does if it doesn't find a match to B16 is what is fascinating to me. If it doesn't find it based on the end of the IFERROR I would expect a blank, but without the first part, """"&, it doesn't return a blank, it returns a 0.

I think you've got it around the wrong way ...

If the formula doesn't find a match, it will return a blank, i.e. the value_if_error you've specified, shown in red below:

=IFERROR(""&VLOOKUP($B16,tbl_status,2,0),"")

If the formula does find a match, but the lookup value in column 2 of tbl_status is blank, Excel will show a zero. Concatenating a leading "" to the lookup value coerces it to a string, so blank will display as blank and not zero.

A potential downside of this approach is that if column 2 of table_status contains the numeric value 123, say, the formula will return the string value "123", which may not be what you want. If you want to return string as string, numeric as numeric, and blank as blank (not zero) you'll need a slightly more complicated formula. Here's one way you could do it:

=IFERROR(IF(ISBLANK(VLOOKUP($B16,tbl_status,2,0)),"",VLOOKUP($B16,tbl_status,2,0)),"")
 
Upvote 0
Concatenating a leading "" to the lookup value coerces it to a string, so blank will display as blank and not zero.

Hi StephenCrump,

You are right, I had that backwards in what I wrote, BUT you did answer my question & I appreciate that very much!
 
Upvote 0
Because we don't want a 0, but instead a blank. It works well, I just didn't understand that using the "" concatenate would force it to string rather than number. Like I mentioned, someone else wrote the formula, I was just trying to understand workings.

Thanks for the question.
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,765
Members
449,049
Latest member
greyangel23

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