If I have a blank cell referenced as a result of a vlookup, Excel returns zero. Is there a way to change this behaviour so that blanks are returned as blanks rather than as zeros?
Thanks,
Archie
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Can Vlookup return blanks? (Excel 2000)
You can never have a formula return a blank. A blank cell means the cell is empty. If you have a formula in a cell, the cell is not blank.
Depending on what you need you can use what Michael suggested:
=IF(VLOOKUP($A3,$A$1:$D$3,3,FALSE)=””,””,VLOOKUP($A3,$A$1:$D$3,3,FALSE))
Which will give a null string (“”) if the “lookup cell” is blank or it returns a result of a null string.
Or even Paul’s formula:
=IF(VLOOKUP(LookupValue,Array,2,FALSE)=0,””,VLOOKUP(LookupValue,Array,2,FALSE))
Which will give a null string (“”) if the “lookup cell” is blank or it returns a result of zero.
If you want the results to be ignored in a chart, you must return a #N/A error, which a chart will ignore. A null or a 0 (or any other error) will plot as a zero on the chart. You can not simulate a truly “blank” entry in a plot with a formula.
Both problems have their downside. In Michael’s both null and blanks will return the same thing, and in Paul’s both zero and blanks will return the same thing.
If you want to return a null for null string, a zero for a zero, and something else (for example, #N/A error) for a blank, you must use a combination of the different formulas:
=IF(AND(VLOOKUP(LookupValue,Array,2,FALSE)=0,VLOOKUP(LookupValue,Array,2,FALSE)=””),NA(),VLOOKUP(LookupValue,Array,2,FALSE))
This will only return the #N/A error (or whatever) when the cell is blank (since that is the only time the cell can be = null and equal to zero). This is probably the closest you can get to returning a “blank”. The only other way is to put a result in the formula above, and afterwards write a macro to “clear” the cells contents if it has that value. (but this would remove the formula.)
Steve
Instead of doing 2 vlookups to check, it hit me on the way to work, just use ISBLANK
=IF(isblank(VLOOKUP(LookupValue,Array,2,FALSE)),na(),VLOOKUP(LookupValue,Array,2,FALSE))
The other alternative which should be mentioned is to replace all the blanks in the data with whatever value you want it to return. This will eliminate the need to do the IF statement at all and you can just use the VLOOKUP by itself
Steve
Instead of doing 2 vlookups to check, it hit me on the way to work, just use ISBLANK
=IF(isblank(VLOOKUP(LookupValue,Array,2,FALSE)),na(),VLOOKUP(LookupValue,Array,2,FALSE))
The other alternative which should be mentioned is to replace all the blanks in the data with whatever value you want it to return. This will eliminate the need to do the IF statement at all and you can just use the VLOOKUP by itself
Steve
You can never have a formula return a blank. A blank cell means the cell is empty. If you have a formula in a cell, the cell is not blank.
Depending on what you need you can use what Michael suggested:
=IF(VLOOKUP($A3,$A$1:$D$3,3,FALSE)=””,””,VLOOKUP($A3,$A$1:$D$3,3,FALSE))
Which will give a null string (“”) if the “lookup cell” is blank or it returns a result of a null string.
Or even Paul’s formula:
=IF(VLOOKUP(LookupValue,Array,2,FALSE)=0,””,VLOOKUP(LookupValue,Array,2,FALSE))
Which will give a null string (“”) if the “lookup cell” is blank or it returns a result of zero.
If you want the results to be ignored in a chart, you must return a #N/A error, which a chart will ignore. A null or a 0 (or any other error) will plot as a zero on the chart. You can not simulate a truly “blank” entry in a plot with a formula.
Both problems have their downside. In Michael’s both null and blanks will return the same thing, and in Paul’s both zero and blanks will return the same thing.
If you want to return a null for null string, a zero for a zero, and something else (for example, #N/A error) for a blank, you must use a combination of the different formulas:
=IF(AND(VLOOKUP(LookupValue,Array,2,FALSE)=0,VLOOKUP(LookupValue,Array,2,FALSE)=””),NA(),VLOOKUP(LookupValue,Array,2,FALSE))
This will only return the #N/A error (or whatever) when the cell is blank (since that is the only time the cell can be = null and equal to zero). This is probably the closest you can get to returning a “blank”. The only other way is to put a result in the formula above, and afterwards write a macro to “clear” the cells contents if it has that value. (but this would remove the formula.)
Steve
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications