30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / How to use Wildcards with VLOOKUP in Excel (Formula)
By Puneet Gogia (Microsoft MVP)

How to use Wildcards with VLOOKUP in Excel (Formula)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

To look up a partial match, join a wildcard to your lookup value with an ampersand: =VLOOKUP(D2&"*",A2:B20,2,0) finds the first entry that starts with the value in D2, so “John” matches “John Smith”. Put the asterisk on both sides — =VLOOKUP("*"&D2&"*",A2:B20,2,0) — to match the text anywhere in the cell, which also gets around stray leading or trailing spaces.

The question mark stands for exactly one character, so =VLOOKUP("???"&D2,A2:B20,2,0) matches an invoice number with a three-character prefix like INV. The last argument must be 0 (exact match) or the wildcards are ignored.

Two things to watch: VLOOKUP returns only the first match, so a partial match on a common first name may give you the wrong row, and if your real data contains a literal * or ?, put a tilde in front of it — "PD~*" — so Excel treats it as a character rather than a wildcard.

I’m sure you want to make VLOOKUP more powerful. Well, using wildcards with VLOOKUP can do this for you. It can help you to look up a value using a partial match.

Now:

Let’s say you have data like the table below, which has students’ full names in one column and their marks in another.

data table use wildcards with vlookup

From this data, you want to look up a particular student’s marks but only with the first name. A normal VLOOKUP doesn’t allow you to look up a value like this.

But, when you combine an asterisk, which is a wildcard character, you can get the student’s marks by just using a partial match. So today in this post, I’d like to share with you how to use wildcard characters with VLOOKUP.

And for this, I have listed 5 real-life examples which can help you to understand this combination.

Types of Wildcards

Now the thing is: You have 3 wildcard characters, which you can use in Excel.

  • Asterisk (*): Matches any number of characters (or none) in that position. For example, you can use “Ex*” to match the text “Excel” from a list.
  • Question Mark (?): Use a question mark in place of exactly one character. For example, you can use P?inter to look up the text “Painter” or “Printer”.
  • Tilde (~): It can nullify the impact of the above two characters. For example, if you want to look up a value “PD*”, instead you can use “PD~*”.

Learn more about wildcard characters from this ultimate guide.

Here I have listed 5 different examples to help you understand how this combination of a wildcard and VLOOKUP works. You can download this sample file from here to follow along.

VLOOKUP with a First Name and an Asterisk

Let’s continue with the example I have shown you above. Here you have a list of names (First + Last), and you have to look up the marks for the students just using the first name.

data table use wildcards with vlookup

When you use a normal VLOOKUP, it will return the #N/A error, which means the value is not there in the list, and that is absolutely right.

use wildcards with vlookup to lookup first name

But, when you combine the lookup value with an asterisk, you get the students’ marks without any error.

use wildcards with vlookup to lookup first name with asterisk

Here’s the formula, where E2 has the first name and A2:B11 is the data with the full names and marks (change the references to match your data):

=VLOOKUP(E2&"*",A2:B11,2,FALSE)

This Is How This Formula Works

In the above formula, you have used an asterisk after the first name, which helps VLOOKUP to look up a value that starts with the first name you have mentioned, and the rest of the value can be anything.

Just keep in mind that VLOOKUP returns the first match it finds. So, if you have both “John Smith” and “Johnny Lee” in the list, “John*” matches whichever comes first. Add a space before the asterisk (“John *”) if you only want first names that are a whole word.

Combine VLOOKUP and an Asterisk to Avoid Trailing Spaces

Now in this data, you just have first names, but again you are not able to get the marks. And the reason is that after removing the last names, the in-between space is left there as a trailing space.

first name data to use with wildcard characters with vlookup

And now, when you try to look up the marks with the first name, you are again getting the #N/A error.

use wildcards with vlookup to lookup first name with space

But yes, you can remove all these unwanted spaces, but here our motive is to use wildcard characters with VLOOKUP to solve this problem.

use wildcards with vlookup to lookup first name with space using asterisk min

Here also you have to use the same formula which you have used above. The asterisk matches the extra space at the end, so the formula returns the marks with the student’s first name.

Partial Invoice Look Up

In the above two examples, you have used an asterisk to perform a partial match for VLOOKUP. But here in this example, we have invoice data with the sales amount.

Here is a twist:

Every invoice number has the prefix text “INV” at the start. Unfortunately, the invoice number which you are using to look up the amount doesn’t have that text.

invoice data to use wildcards with vlookup

And with a normal VLOOKUP, it’s not possible to get the sales amount.

a normal invoice lookup partial match min

And by using a wildcard the formula will look something like this:

partial invoice lookup with wildcards min

Here’s the formula, where E2 has the invoice number without the prefix:

=VLOOKUP("???"&E2,A2:B11,2,FALSE)

How This Formula Works

In the above formula, you have combined three question marks with the invoice number as a prefix.​ As I mentioned above, a question mark represents exactly one character.

Here these 3 question marks are representing those 3 characters that you have at the start of the invoice numbers.

And that’s how it looks up the sales amount with a partial match. The joined value (“???1234”) is text, so it works even when the invoice number in E2 is a number.

Use a Question Mark with VLOOKUP to Match a PRODUCT ID

Let’s do it again with this example, where you have product IDs that are a combination of 4 numbers, 3 letters, and 3 numbers. Now, you need to look up the amount of a particular product.

product id data to use wildcards with vlookup

This is crazy:

In this data, you only know the starting number of the product ID, and the last number is the same in all the IDs. But the problem is the text in the middle, which you don’t have.

simple product id lookup with wildcards min

To solve this problem, you need to again combine question mark wildcards with a VLOOKUP. And the formula will be something like this:

product id lookup with question mark wildcard min

How This Formula Works

In the above formula, the question marks represent the text we have in the original product ID list, one question mark for each character. So, for 3 letters in the middle, you need 3 question marks, like “1001???100”.

Nullifying the Effect of Wildcard Characters in VLOOKUP

There will be a situation where you need to remove the effect of wildcards. Let’s have a look at the below data, where we have values in the column with an asterisk. And here, these asterisks are not used as wildcard characters, but they are part of the actual values.

wrong lookup an asterisk min

You might be wondering:

When you try to look up a value that includes an asterisk, Excel will treat it as a wildcard character instead of a normal value.

So here you need to nullify the effect of that wildcard character. For this, you have to use a tilde. And you need to use a formula like this:

nullfying the effect of wildcard min

When you use a tilde before an asterisk or a question mark, it will nullify its effect, and Excel will treat it as a normal text character.

For example, to look up the value “PD*” as it is:

=VLOOKUP("PD~*",A2:B11,2,FALSE)

And if the lookup value comes from a cell, you can add the tilde with SUBSTITUTE:

=VLOOKUP(SUBSTITUTE(E2,"*","~*"),A2:B11,2,FALSE)

Look Up a Value That Contains a Text

All the examples above match the start or a fixed position of the value. To find a value that contains your text anywhere, use an asterisk on both sides. For example, this formula finds the marks with only the last name in E2:

=VLOOKUP("*"&E2&"*",A2:B11,2,FALSE)

Wildcards with XLOOKUP

In Microsoft 365 and Excel 2021 and later, XLOOKUP also works with wildcards, but you need to turn them on with 2 as the match_mode argument. Without it, XLOOKUP treats * and ? as normal characters:

=XLOOKUP(E2&"*",A2:A11,B2:B11,"Not Found",2)

Frequently Asked Questions

Do wildcards work with approximate match in VLOOKUP?

No. Wildcards only work when the last argument of VLOOKUP is FALSE (exact match) and the lookup value is text.

Why does my wildcard VLOOKUP return the wrong value?

More than one value matches the pattern, and VLOOKUP returns the first one from the top. Make the pattern more specific, like adding a space before the asterisk.

Do wildcards work with numbers?

Only with numbers stored as text. A pattern like “10*” doesn’t match the number 1001 in a cell, because wildcards only compare text.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

22 thoughts on “How to use Wildcards with VLOOKUP in Excel (Formula)”

  1. Hi,
    Puneet ji,

    How can I match between two invoice numbers using vlookup formula ?
    i.e T06/21/141018 & TO6/21/141018 ?
    T06/19/141018 & T06/21/141018 ?
    T06/21/141018 & TO6/19/141018 ?

    Reply
  2. GREAT! Very helpful examples. I’ve never needed to use wildcards with VLOOKUP but this morning was looking for reasons why people use them.

    Reply
    • I used to work on data with phone numbers and at that time I realized that the use of wildcard characters is REAL. 🙂

      Reply
  3. Thanks for the examples & techniques. One small point – your example for tilde before the * shows the formula with
    “*~”
    I assume this should be
    “~*”
    ?

    Reply
  4. how to lookup value when ~ is there in lookup value and data both.
    like
    12~34 Rick
    12~35 Jack

    how to lookup name against
    12~34

    Reply
    • Hi, I have the same issue, and I spent a lot of time to solve it. You will save a lot of my hair, because I didn’t know about wildcards in VLOOKUP.

      Would be solution to “bypass” wildcarding/nulyfying of ~ with double? Like “~~”?

      Reply
  5. Can you limit this only to look for a numerical value or a character in the question mark or asterisk?

    Such as finding this “CL123..” but not this “CLAMP …”

    Reply
    • I never seen before this type of formula super Puneet great job thanks for this stuff

      Reply
    • Stay tuned, you’ll get some awesome stuff in coming days. 🙂

      Reply
  6. Learnt new things about VLOOKUP ! Many thanks for sharing !!

    Reply
  7. Need more example on (~) concept in vlookup?? Plz….

    Reply

Leave a Comment