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), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Returning Blanks or Asterisks from a Lookup.

# Returning Blanks or Asterisks from a Lookup

by Allen Wyatt
(last updated May 19, 2018)

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.

Yes, this can be done, but not without making your formula just a bit more complex. 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 (Tools | Options | View tab | clear the Zero Values check box). 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))
```

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3335) 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 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

Quickly Changing Tab Alignment

Need to change the alignment of some tabs in a multitude of paragraphs? How you approach the problem depends on whether ...

Discover More

Using Mail Merge to Complete Documents

Mail merge can be used to put together groups of documents that rely on common information. This tip shows how mail merge ...

Discover More

Where Are Templates Stored?

Need to know where templates are located in Word 2007? The locations may be the same as in earlier versions of the ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

Returning Item Codes Instead of Item Names

The data validation capabilities of Excel are really handy when you want to limit what is put into a cell. However, you ...

Discover More

Looking Backward through a Data Table

Sometimes you need to look backward, through the information above your formula, to find the data you need. This can be ...

Discover More

Using the COLUMN Function

Need to know the column number for use in a formula? The worksheet function you want is the COLUMN function, described in ...

Discover More
##### Subscribe

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

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 7 + 7?

There are currently no comments for this tip. (Be the first to leave your commentâ€”just use the simple form above!)

##### This Site

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.