Using wildcards with VLOOKUP

VLOOKUP with wildcards

Have you ever played Scrabble?  It is the game where you receive points for constructing words from letters printed on small plastic tiles.  In my opinion, the best tile to get is always the blank tile.  It doesn’t score any points, but it can be used to represent any letter at all.  Therefore, if you have a blank tile in your rack of letters it becomes much easier to create words.  Wildcard characters in Excel work in a similar way to the blank tile in Scrabble. But wildcards go just a little bit further; you can combine several blanks together, or even allow an unlimited number of blanks.  When combined with VLOOKUP we can create a very powerful lookup/search feature.

Normally when using VLOOKUP we are trying to find an exact match; sometimes we are happy with an approximate match (i.e. the next closest match), but sometimes we want to find an even looser match – these are the circumstances in which we would use wildcards.

The 3 wildcard characters

Wildcard characters can be used instead of actual characters:

Question mark (?)

A ? can take the place of any single character.  If we had the text “Ex?el” then the ? could be any character (just like the blank scrabble tile).  So, the text could be “Excel”, “Exuel”, “Ex7el”, or any other letter in the place of the ??

It is also possible to combine multiple question marks (?) together.  For example, ??? would represent any three characters, but it must be 3 characters, no less, no more.

Asterisk (*)

A * represents any number of characters (even no characters).  If we had the text “Ex*” then the matches could be “Excel”, “Exam”, “Explain”, or any other word starting with “Ex”, including just “Ex”.

Tilde (~)

This is not strictly a wildcard character.  It is used before a ? or a * to indicate that the ? or * should not be used as a wildcard character.  For example, “Ex~*” would only match “Ex*”, as the * is not treated as a wildcard character, but as a character in its own right.

Using wildcard characters with VLOOKUP

Let’s look at an example.

We have a list of trees and their prices.

VLOOKUP wildcards

Example 1

The formula in E6 is:


This is a basic VLOOKUP calculation.

Cell E4 contains the value we are looking up.  Where the lookup value is “White” there are no matches, therefore “#N/A” is returned.

We could change our formula to join an asterisk (*) to the end of the lookup value as follows:


This would change the lookup value to “White*”, which would return a value of 20.

We could also achieve this by changing the value in cell E4 to “White*”.

VLOOKUP wildcards *

“White*” would match with any word starting with “White”, such as “White Spruce”.  There is also a match for “White Willow”, but “White Spruce” is first in the list, so that is the value returned.

Example 2

Using an asterisk (*) either side of the lookup value provides a match for any string where the text between the asterisks (*) is present.

VLOOKUP wildcards * twice

Looking up “*Willow*” will return any word containing “Willow”

Example 3

It is also possible to mix question marks (?) and asterisks (*), such as in the following example:

VLOOKUP wildcards ? and *

The ? can only be exchanged for a single character, but the * can represent any number of characters.

Other circumstances to use wildcard characters

Wildcard characters can be used whenever matching text strings, common functions might be HLOOKUP, MATCH, SEARCH, SUMIFS and SUMIF.

Wildcard characters can even be used when using the find functionality within Excel.

Download the Advanced VLOOKUP Cheat Sheet

Download the Advanced VLOOKUP Cheat Sheet.  It includes most of the tips and tricks we’ve covered in this series, including faster calculations, multiple criteria, left lookup and much more.

Please download it and pin it up at work, you can even forward it onto your friends and co-workers.

Advanced VLOOKUP Cheat Sheet

The download is available to newsletter subscribers, click the button below to become a subscriber and download the file.

Download Icon

Other posts in the Mastering VLOOKUP Series

Don’t forget:

If you’ve found this post useful, or if you have a better approach, then please leave a comment below.

Do you need help adapting this to your needs?

I’m guessing the examples in this post didn’t exactly meet your situation.  We all use Excel differently, so it’s impossible to write a post that will meet everybody’s needs.  By taking the time to understand the techniques and principles in this post (and elsewhere on this site) you should be able to adapt it to your needs.

But, if you’re still struggling you should:

  1. Read other blogs, or watch YouTube videos on the same topic.  You will benefit much more by discovering your own solutions.
  2. Ask the ‘Excel Ninja’ in your office.  It’s amazing what things other people know.
  3. Ask a question in a forum like Mr Excel, or the Microsoft Answers Community.  Remember, the people on these forums are generally giving their time for free.  So take care to craft your question, make sure it’s clear and concise.  List all the things you’ve tried, and provide screenshots, code segments and example workbooks.
  4. Use Excel Rescue, who are my consultancy partner.   They help by providing solutions to smaller Excel problems.

What next?
Don’t go yet, there is plenty more to learn on Excel Off The Grid.  Check out the latest posts:


Leave a Reply

Your email address will not be published. Required fields are marked *