Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Returning Blanks or Asterisks from a Lookup.

Returning Blanks or Asterisks from a Lookup

Written by Allen Wyatt (last updated October 9, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


4

Bob asked if there was a way to use VLOOKUP to return blanks or asterisks if the function cannot make a match in a lookup table.

This can easily be done using the XLOOKUP function available in Excel 2021, 2024, and Microsoft 365. The reason is because XLOOKUP, unlike other lookup functions, allows you to specify what should be returned if the value being searched for cannot be found. Here's an example:

=XLOOKUP(5,A1:A10,B1:B10,"*****")

XLOOKUP searches through cells A1:A10 looking for the value 5. If it is found, then the corresponding value from B1:B10 is returned. If it is not found, then the string of asterisks is returned.

It can also be done in earlier versions of Excel using VLOOKUP, but it takes a bit more work and requires a bit more explanation. The trick is to remember that VLOOKUP can operate in one of two ways. By default, it returns the next lower value to the one being looked for, if the data table is in ascending order and if there isn't an exact match. However, you can force VLOOKUP to only return exact matches, if desired. Consider the following example:

=VLOOKUP(5,A1:B10,2,FALSE)

This example searches through the lookup table (A1:B10) looking for the value 5 in the first column of the table. If it is found, then the corresponding value from the second column is returned. If it is not found, then VLOOKUP returns an #N/A error, indicating it could not locate the value. (The FALSE value as the fourth parameter indicates you don't want approximate matches.)

The key, then, is to play off this #N/A value and build what you want returned if there isn't a match. The following formula will return a series of five asterisks if there wasn't a match in the lookup:

=IF(ISNA(VLOOKUP(5,A1:B10,2,FALSE)),"*****",VLOOKUP(5,A1:B10,2,FALSE))

The ISNA function is used to test if the result of VLOOKUP is the #N/A error. If it is, then the asterisks are returned; if not, then the lookup value is returned. If you want the formula to return "nothing," then you can use this variation:

=IF(ISNA(VLOOKUP(5,A1:B10,2,FALSE)),"",VLOOKUP(5,A1:B10,2,FALSE))

This version returns a blank string if there was not a match in the lookup table. For some uses, this may not be exactly what you want. You may find it more appropriate to return a zero, and then hide zeroes in the worksheet (File | Options | Advanced | Display Options for this Worksheet | Clear the Show a Zero in Cells that have Zero Value). If you'd like a zero returned, then it takes only one change:

=IF(ISNA(VLOOKUP(5,A1:B10,2,FALSE)),0,VLOOKUP(5,A1:B10,2,FALSE))

Of course, you could also use the IFERROR function to find what you need. The following variation on the formula will work just fine:

IFERROR(VLOOKUP(5,A1:B10,2,FALSE),"*****")

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10940) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Returning Blanks or Asterisks from a Lookup.

Author Bio

Allen Wyatt

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

MORE FROM ALLEN

Starting Chapters on Odd-Numbered Pages

Want to start a new heading on an odd-numbered page? You can do it with section breaks, obviously, but you can also do it ...

Discover More

Creating a Center Across Selection Button

The ability to center text across a range of cells has long been a staple of experienced Excel users. Here's how to ...

Discover More

Printing a Bookmark List with Contents

Bookmarks can be a great tool in Word, allowing you to easily remember the location of desired blocks of text. If you ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Phantom Counts

Two common worksheet functions used to count things are COUNT and COUNTA. Not understanding how these functions treat ...

Discover More

Finding Unique Rows Based on Two Columns

Using the UNIQUE function you can derive unique values from a range of cells. By expanding the range of cells accessed by ...

Discover More

Returning an ANSI Value

Need to know the character value of the first character in a string? It's easy to do, without using a macro, by using the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four more than 2?

2020-10-14 04:31:55

Alex B

@David, appreciate the feedback. I am only on the standard Office 365 so you should have access to all the new Dynamic Array functions. The FILTER function seems to be particularly versatile. I have seen some very unexpected uses of that one.


2020-10-13 09:50:52

David Gray

Thanks for the heads up, Alex. Since my copy of Excel is part of Office 365, I have access to XLOOOKUP, but I was unaware of its existence.


2020-10-11 10:47:04

David Gray

Another useful option addresses the issue of blank lookup values without the need for hiding all zeros, which prevents differentiating blank cells from cells with a value of zero. This is especially significant when you take into account that when the target of a lookup is set to blank by a formula, the lookup functions return a zero.

=if(LEN(VLOOKUP(5,A1:B10,2,FALSE))>0,VLOOKUP(5,A1:B10,2,FALSE),"")

This formula leverages the fact that the length of a cell that has a computed value of blank is zero, the length of the empty string. If said length is greater than zero, the TRUE argument of the IF function returns the lookup value. Otherwise, its FALSE argument returns the empty string.


2020-10-10 06:28:01

Alex B

If you have Office 365 you could go straight to XLOOKUP
Format:-
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
eg
=XLOOKUP(5,A1:A10,B1:B10,"*****")
Where the "if_not_found" is "*****" and could just as easily be "" or 0.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.