Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (2024)

Written by co-founder Kasper Langmann, Microsoft Office Specialist.

In this tutorial, you’ll learn about the awesome wildcard characters in Excel.
Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (1)

But, what exactly are “wildcards”?

Wildcards are extremely helpful when you need to find results that are less than exact.

As you’ll see a bit later in this tutorial, the wildcards are particularly helpful in overcoming a common obstacle when using lookup functions.

Table of contents

  • 1: Overview of the 3 wildcards (+free sample file!)

  • 2: Most popular: The asterisk (*)

  • 3: Using the question mark (?) as wildcard

  • 4: Modifying wildcards with tilde (~)

  • 5: Using wildcards and functions

The 3 different wildcards

There are three different wildcards available for use in Excel and as you can imagine, they all have a different application.

There is the asterisk (*), the question mark (?), and the tilde (~).

Each in their own slightly different manner, these wildcard characters are able to take on any value.

Each in their own slightly different manner, these wildcard characters are able to take on any value.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (2)Kasper Langmann, Co-founder of Spreadsheeto

Follow along by downloading our sample file right below!

Download Your FREE Sample File

The asterisk as a wildcard (*)

The first wildcard we want to examine is the asterisk symbol. This is the most general wildcard of the group.

The asterisk wildcard can take on the value of any number of characters.

For instance, if we substitute the asterisk like ‘Sh*’, it could represent strings like ‘Sheet’, ‘Show’, ‘She’, ‘Shake’, ‘Shoes’, ‘Shirts’, and so on.

It can be placed at the beginning of a string like “*-01”. This would recognize all values that end with ‘-01’ regardless of the number of characters preceding it.

The usefulness of the asterisk as a wildcard should start to become a bit more obvious to you by now, right 🙂 ?

Now that we have an explanation of how the asterisk wildcard works, let’s take a look at a practical example of how we might use it with a filter on a column of data.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (3)Kasper Langmann, Co-founder of Spreadsheeto

Let’s see exactly how you can use the asterisk wildcard

Consider: A column of organization names, some of which contain the ‘LLC’ abbreviation.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (4)

We can now filter on all those organizations in the list that are an LLC using the asterisk wildcard.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (5)

And then we get the following result…

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (6)

Note that once we type ‘*LLC’ into the text box of the filter, all the entries without ‘LLC’ in it are eliminated.

Once we click ‘OK’ our list is now filtered on all entries that have ‘LLC’ at the end of the string.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (7)Kasper Langmann, Co-founder of Spreadsheeto

Let’s see what happens when we change our filter to ‘*C’.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (8)

Notice that the filter now returns ‘WASTE MANAGEMENT OF MO INC’ in addition to all the previous organizations returned with the ‘*LLC’ search.

By eliminating the ‘LL’ from our previous filter we have further generalized and now all values ending in ‘C’ are included in the filter.

The wildcard also works in this case regardless of letter case.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (9)

We can also expand our filter by applying the asterisk to the beginning of our search string if the need calls for it.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (10)

Notice here that we were able to capture more entries from the list by expanding our wildcard search to include any number of characters both prior to and after the term ‘city’.

By using ‘city*’ we would have never captured all entries with ‘city’ in its string.

The question mark as a wildcard

The question mark as a wildcard takes on the value of any single character.

The question mark can be used to be more specific in what we are searching for – while still not being totally exact.

We can take a look at an example of how this works while building on what we already know about the asterisk as a wildcard.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (11)Kasper Langmann, Co-founder of Spreadsheeto

Example: Let’s take a look at the question mark in action

In this next example, we will use the question mark as a wildcard for the following string: ‘c?ty’.

This will filter all entries with a substring that contains any single character between ‘c’ and ‘ty’.

However, the only way for us to get any results within a larger string is by placing the asterisk as a wildcard at the beginning and end of ‘c?ty’.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (12)

Notice that the filter shows entries that contain ‘CITY’ in the string, just as we would expect.

As a contrast, let’s replace the question mark wildcard with an asterisk.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (13)

Notice, in this case, the filter contains the same values but now there is an additional value for ‘JACKSON COUNTY MISSOURI’ since we expanded our filter by using the asterisk.

Using the tilde

What about those situations where you might want to use the wildcard characters themselves as literal characters as a part of our search?

If Excel recognizes the asterisk and the question mark as wildcards by default, how do we keep Excel from doing so in those cases where these characters are actually a part of our string?

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (14)Kasper Langmann, Co-founder of Spreadsheeto

We use the tilde, or ‘~’.

Anytime we want the asterisk or question mark to not be a wildcard, we simply place a tilde just before it.

Consider the following example where we have a table of values.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (15)

Let’s see what happens when we use the asterisk as a wildcard to filter all values that have any number of characters following an asterisk character in its string.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (16)

Based on what we have already discussed, we shouldn’t be surprised that this is our result.

But what we really want to do is isolate the value like ‘How?*’.

In order to do this, we have to place a ‘tilde’ prior to our second asterisk in the filter.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (17)

The first asterisk in our search term is the wildcard while the second asterisk is an actual character since the tilde precedes it.

Therefore, our search finds only values that end with an asterisk (in this case ‘How?*’).

Note: This same concept holds for the question mark wildcard.

Using wildcards with Excel functions

In addition to using wildcards for filtering and finding data in Excel, there are several functions in which we can also leverage the power of wildcards.

Some of these functions include ‘COUNTIF’ and ‘COUNTIFS’, ‘SEARCH’, ‘SUMIF’ AND ‘SUMIFS’, as well as ‘HLOOKUP’ and ‘VLOOKUP’.

This is an incomplete list, but the common thread is that these functions require some sort of reference or lookup criteria in which a wildcard can be useful in contrast to an exact value.

We will take a look at using the ‘*’ wildcard in a scenario involving the ‘VLOOKUP’ function.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (18)Kasper Langmann, Co-founder of Spreadsheeto

We will use the same data we have been looking at for our filter exercises. Let’s say we want to pull in the address for our organizations we have listed in the ‘Entity Name’ column.

We will match our ‘Entity Name’ entries for each row to the ‘Taxpayer Name’ column in the lookup table.

However, there seems to be a minor issue that is going to cause us problems.

The values in the ‘Taxpayer Name’ column of our lookup table has and ID number associated that prohibits us from matching our fields exactly.

While there are different methods for approaching this challenge, we are going to leverage what we have just learned about using wildcards to make this ‘VLOOKUP’ work.

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (21)Kasper Langmann, Co-founder of Spreadsheeto

First, let’s see what happens when we try to match values in the ‘Entity Name’ column of our first table to the values in the ‘Taxpayer Name’ column of our lookup table.

Because our values do not match exactly, the ‘VLOOKUP’ returns the ‘#N/A’ error.

It does not recognize our lookup value in the lookup table.

But we can add the ‘*’ wildcard to the end of our lookup value to remedy this issue.

This only works because the ‘Taxpayer Name’ values in the lookup table are derivatives of the lookup values in our original table.

Notice that we concatenate (or join) the ‘*’ wildcard to the end of our lookup value by typing the cell reference of our lookup value followed by the ampersand (‘&’) and then the asterisk in double quotes(“*”).

The wildcard symbol needs to be added to the lookup value as a literal string and that is why the double quotes are necessary.

So you’ve just learned how to use wildcards in Excel, whether it’s the asterisk, question mark, or tilde. More importantly, you also learned how to integrate these wildcards into your every day functions. Good job!

Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (24)Kasper Langmann, Co-founder of Spreadsheeto

Kasper Langmann2020-11-05T11:28:27+00:00
Wildcards in Excel: Asterisk (*), Question Mark (?), and Tilde (~) Explained! (2024)

FAQs

What does * wildcard do in Excel? ›

What are wildcard characters in Excel? Wildcard characters in Excel are special characters that can be used to take the place of characters in a formula. They are employed in Excel formulas for incomplete matches. Excel supports wildcard characters in formulas to return values that share the same pattern.

What does the question mark wildcard mean in Excel? ›

Excel Wildcard Characters – An Introduction

* (asterisk) – It represents any number of characters. For example, Ex* could mean Excel, Excels, Example, Expert, etc. ? (question mark) – It represents one single character.

What is the difference between in asterisk (*) and question mark (?) wildcards? ›

Alternatively referred to as a wild character or wildcard character, a wildcard is a symbol used to replace or represent one or more characters. The most common wildcards are the asterisk (*), which represents one or more characters and question mark (?) that represents a single character.

How do you find wildcards in Excel? ›

For more about using wildcard characters with the Find and Replace features in Excel, see Find or replace text and numbers on a worksheet.
...
Using wildcard characters in searches.
UseTo find
* (asterisk)Any number of characters For example, *east finds "Northeast" and "Southeast"
2 more rows

What is tilde Excel? ›

Microsoft Excel uses the tilde (~) as a marker to indicate that the next character is a literal. When you use the Find and Replace dialog box to find or replace a character such as a tilde (~), you must add a tilde (~) before the character in the Find what box.

How do you use wildcards? ›

The CHARLIST is enclosed in brackets ([ ]) and can be used with wildcard characters for more specific matches.
...
Examples of wildcard character pattern matching in expressions.
C haracter(s)Use to match
? or _ (underscore)Any single character
* or %Zero or more characters
5 more rows

What does asterisk in Excel mean? ›

An asterisk (*) means "one or more characters", while a question mark (?) means "any one character". These wildcards allow you to create criteria such as "begins with", "ends with", "contains 3 characters" and so on.

What do you understand by wildcard characters? ›

A wildcard character is a type of meta character . In various games of playing cards, a wild card is a designated card in the deck of cards (for example, the two of spades) that can be used as though it were any possible card.

What is the difference between asterisk and question mark? ›

The question mark indicates zero or one occurrences of the preceding element. For example, colou? r matches both "color" and "colour". * The asterisk indicates zero or more occurrences of the preceding element.

What is the purpose of * wildcard in selector? ›

Wildcards are symbols that enable you to replace zero or multiple characters in a string. These can be quite useful when dealing with dynamically-changing attributes in a selector.

What is difference between * and & wildcard character? ›

Difference between wildcards (*) and (?)

A wildcard character is a kind of placeholder represented by a single character, such as an asterisk (*) and question mark (?), which can be interpreted as a number of literal characters or an empty string. It is often used in file searches so the full name need not be typed.

What is a wild card explain their types and uses with examples? ›

A wildcard is a symbol that takes the place of an unknown character or set of characters. Commonly used wildcards are the asterisk ( * ) and the question mark ( ? ). Depending on the software or the search engine you are using, other wildcard characters may be defined.

What does double asterisk mean in Excel? ›

Double Asterisk ( ** ) matches zero or more characters across multiple segments. It is used for globbing files that are in nested directories.

Can you use wildcards in Excel Find and Replace? ›

Excel wildcard for numbers. It is sometimes stated that wildcards in Excel only work for text values, not numbers. However, this is not exactly true. With the Find and Replace feature as well as Filter, wildcards work fine for both text and numbers.

Can you use a wildcard for numbers in Excel? ›

Excel supports the wildcard characters "*" and "?", and these wildcards can be used to perform partial (substring) matches in various lookup formulas. However, if you use wildcards with a number, you'll convert the numeric value to a text value.

How do I filter an asterisk in Excel? ›

How to filter data by containing asterisk or other special characters in Excel?
  1. Select the data range you want to filter, and click Data > Filter.
  2. Then click the Filter arrow on the column which you want to filter by to show the context menu, and click Number Filters (Text Filters) > Custom Filter.
Apr 5, 2016

Top Articles
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 5782

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.