Loading

Got a version of Excel that uses the
menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)?
**This site is for you!** If you
use a later version of Excel, visit
our *ExcelTips* site focusing on the ribbon interface.

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company.

Learn more about Allen...

ExcelTips FAQ

ExcelTips Resources

Ask an Excel Question

Make a Comment

Free Business Forms

Free Calendars

** Please Note:** This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later),

When you use VLOOKUP to return a value from a data table, the function does not differentiate between blanks and zero values in what it returns. If the source value is zero, then VLOOKUP returns 0. Likewise, if the source is blank, then VLOOKUP still returns the value 0. For some purposes, this may not do—you need to know whether the cell being looked up is blank or if it really contains a 0.

There are many different solutions that could be pursued. One solution relies on the fact that even though VLOOKUP returns a 0, it will correctly report the length of the source cell. Thus, if you use the LEN function on what is returned, if the source cell is empty the LEN function returns 0, but if the source contains a 0 then LEN returns 1 (the 0 value is 1 character in length). This means that you could use the following formula in place of a standard VLOOKUP:

=IF(LEN(VLOOKUP(B1,D:E,2,0))=0,"",VLOOKUP(B1,D:E,2,0))

In this case if the length of what VLOOKUP returns is 0, then Excel doesn't actually do a lookup—it forces a blank to be returned. Only if the length is not 0 is the actual VLOOKUP performed.

There are other variations on this same concept, each testing a different characteristic of the data being referenced and then making the decision as to whether to actually look up that data. This variation, for example, directly tests to see if the source is blank:

=IF(VLOOKUP(B1,D:E,2)="","",VLOOKUP(B1,D:E,2))

The formula can also be modified to check the source cell for multiple conditions. For instance, this variation returns a blank if the source is blank or if the source contains an #N/A error:

=IF(ISNA(VLOOKUP(B1,D:E,2,0))+(VLOOKUP(B1,D:E,2,0)="") ,"",VLOOKUP(B1,D:E,2,0))

*ExcelTips* is your source for cost-effective Microsoft Excel training. This tip (3075) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Returning Blanks with VLOOKUP.

*Related Tips:*

**Comprehensive VBA Guide** Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out *Mastering VBA for Office 2010* today!

I am hoping someone can assist as I am unable to find a solution. I am able to show text in a cell where there is an error with the following:

=IFERROR(LOOKUP(G2,DATA!$B$3:$C$64),"Not Found")

However, I have not been able to get the cell to return a blank where no information is contained in the cell G2.

Any help/suggestions would be gratefully received.

=IFERROR(LOOKUP(G2,DATA!$B$3:$C$64),"Not Found")

However, I have not been able to get the cell to return a blank where no information is contained in the cell G2.

Any help/suggestions would be gratefully received.

I am trying to make a data sheet that pulls dates from another sheet. When the other tab has no date in it i want it to stay blank and not put 1/1/1900. This is the formula i have now.

=VLOOKUP(A7,'Student Management'!A:G,5,FALSE)

=VLOOKUP(A7,'Student Management'!A:G,5,FALSE)

@javi,

Would you be so king to explain what difference did you find and/or for what reason did you present your formula A FULL WEEK(!) after my suggestion ?

=VLOOKUP(B1,D:E,2,)&""

I do hope you wont suggest =B1+A1 after someone else have suggested: =A1+B1 (Believe me it is a bad habit)

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

Would you be so king to explain what difference did you find and/or for what reason did you present your formula A FULL WEEK(!) after my suggestion ?

=VLOOKUP(B1,D:E,2,)&""

I do hope you wont suggest =B1+A1 after someone else have suggested: =A1+B1 (Believe me it is a bad habit)

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

Javi, would you mind explaining the logic behind why that works?

Thanks!

Thanks!

Thanks to Javi! His suggestion worked!

a way working for me is

=""&VLOOKUP(B1,D:E,2,0)

=""&VLOOKUP(B1,D:E,2,0)

@Bob Hartmann,

To the best of my experience - you can use: =VLOOKUP(B1,D:E,2,)&""

for any returned value (Numeric or Text) except DATE.

For dates I, usually, use:

=IFERROR(1/(1/VLOOKUP(B1,D:E,2,)),"")

*** The IFERROR suits all Excel version since "2007".

For earlier versions use:

=IF(VLOOKUP(B1,D:E,2,),VLOOKUP(B1,D:E,2,),"")

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

To the best of my experience - you can use: =VLOOKUP(B1,D:E,2,)&""

for any returned value (Numeric or Text) except DATE.

For dates I, usually, use:

=IFERROR(1/(1/VLOOKUP(B1,D:E,2,)),"")

*** The IFERROR suits all Excel version since "2007".

For earlier versions use:

=IF(VLOOKUP(B1,D:E,2,),VLOOKUP(B1,D:E,2,),"")

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

I have used the "IF" variant for a long time. However, after looking at this tip, the fact that VLOOKUP returns a zero length for a blank cell gave me a new idea. If you are expecting a TEXT (string) value to be returned by the VLOOKUP, you can use CONCATENATE(VLOOKUP(...),"") to eliminate the zeros. Also, if you expect a numeric value and you don't care about zero values, just format the cells with a format like <positive format>;<negative format>;<empty>. This will also turn the zeros to blanks.

Hello,

Have an issue with a blank cell. Example: C2 have to enter data, D2 contains following VLOOKUP ( =VLOOKUP(C2;'Sounding Tables'!$A$9:$E$361;3;FALSE)), cell E2 (=D2-D1). I am trying to work with "IF" in order keep cell E2 blank when cell C2 has no data entered or blank.

Somebody an idea to help me out?

Thanks in advance.

Have an issue with a blank cell. Example: C2 have to enter data, D2 contains following VLOOKUP ( =VLOOKUP(C2;'Sounding Tables'!$A$9:$E$361;3;FALSE)), cell E2 (=D2-D1). I am trying to work with "IF" in order keep cell E2 blank when cell C2 has no data entered or blank.

Somebody an idea to help me out?

Thanks in advance.

Very Helpful Page of information.

Thank you for posting this help page!!

Hello,

I need to find the first blank cell above specified one how can I make this without entering VBA

Thanks a lot

Samuel

I need to find the first blank cell above specified one how can I make this without entering VBA

Thanks a lot

Samuel

currently my formula is:

=vlookup(C10,sheet3!$A$2:$C$1572,2)

I'm receiving N/A's due to blanks in my column C. I think i'm confused as to how i'd create my formula to leave me blanks. CAn anyone please assist me with the formula i have above? Help anyone?

=vlookup(C10,sheet3!$A$2:$C$1572,2)

I'm receiving N/A's due to blanks in my column C. I think i'm confused as to how i'd create my formula to leave me blanks. CAn anyone please assist me with the formula i have above? Help anyone?

& needless to mention this is blilliance.....

Heartiest thanks mate & god bless you...!

Huge thank you brilliant!

John Wu - that's brilliant, and means there is only 1 VLOOKUP performed, no matter what!

As usual, the tips worked miracles. Thank you!!!

Starting excel 2007 and on you can use =IFERROR(whatever,"") to get a blank in place of #NA and others. Enjoy

Like that idea John Wu thanks

<blockquote>

Only if the length is not 0 is the actual VLOOKUP performed.

</blockquote>

Surely this isn't right! Excel has to do one lookup to establish whether the looked up value is blank or not. If it isn't, won't Excel do the lookup again to return the value?

So Excel will do either 1 lookup or 2, not 0 or 1.

Maybe Excel is clever enough to cache somehow the result of the first lookup to reuse for the false condition of the if. Maybe it isn't...

Only if the length is not 0 is the actual VLOOKUP performed.

</blockquote>

Surely this isn't right! Excel has to do one lookup to establish whether the looked up value is blank or not. If it isn't, won't Excel do the lookup again to return the value?

So Excel will do either 1 lookup or 2, not 0 or 1.

Maybe Excel is clever enough to cache somehow the result of the first lookup to reuse for the false condition of the if. Maybe it isn't...

Re john, brilliant!

I will use the formula =VLOOKUP(B1,D:E,2,0) & "" to handle the blank value issue

Munish Kumar. Ask nicely.

Thanks the =IF(VLOOKUP(B1,D:E,2)="","",VLOOKUP(B1,D:E,2))

was very useful

was very useful

Kindly send us excel formula (if and len).