There are only 3 Excel wildcard characters (asterisk, question mark, and tilde) and a lot can be done using these. In this tutorial, I will show you four examples where these Excel wildcard characters are absolute lifesavers.

Excel Wildcard Characters – An Introduction

Wildcards are special characters that can take any place of any character (hence the name – wildcard).  There are three wildcard characters in Excel: Note: I have not come across many situations where you need to use ~. Nevertheless, it is a good to know feature. Now let’s go through four awesome examples where wildcard characters do all the heavy lifting.

Excel Wildcard Characters – Examples

Now let’s look at four practical examples where Excel wildcard characters can be mighty useful:

#1 Filter Data using Excel Wildcard Characters

Excel wildcard characters come in handy when you have huge data sets and you want to filter data based on a condition. Suppose you have a dataset as shown below:

You can use the asterisk (*) wildcard character in data filter to get a list of companies that start with the alphabet A. Here is how to do this:

Select the cells that you want to filter. Go to Data –> Sort and Filter –> Filter (Keyboard Shortcut – Control + Shift + L). Click on the filter icon in the header cell  In the field (below the Text Filter option), type A* Click OK.

How does it work? – When you add an asterisk (*) after A, Excel would filter anything that starts with A. This is because an asterisk (being an Excel wildcard character) can represent any number of characters. Now with the same methodology, you can use various criteria to filter results. If you use A?C instead, you will only get ABC Ltd as the result (as only one character is allowed between ‘a’ and ‘c’)

#2 Partial Lookup Using Wildcard Characters & VLOOKUP

Partial look-up is needed when you have to look for a value in a list and there isn’t an exact match. For example, suppose you have a data set as shown below, and you want to look for the company ABC in a list, but the list has ABC Ltd instead of ABC.

You can not use the regular VLOOKUP function in this case as the lookup value does not have an exact match. If you use VLOOKUP with an approximate match, it will give you the wrong results. However, you can use a wildcard character within VLOOKUP function to get the right results: Enter the following formula in cell D2 and drag it for other cells:

How does this formula work? In the above formula, instead of using the lookup value as is, it is flanked on both sides with the Excel wildcard character asterisk () – “”&C2&”*” This tells excel that it needs to look for any text that contains the word in C2. It could have any number of characters before or after the text in C2. Hence, the formula looks for a match, and as soon as it gets a match, it returns that value.

3. Find and Replace Partial Matches

Excel Wildcard characters are quite versatile. You can use it in a complex formula as well as in basic functionality such as Find and Replace. Suppose you have the data as shown below:

In the above data, the region has been entered in different ways (such as North-West, North West, NorthWest). This is often the case with sales data. To clean this data and make it consistent, we can use Find and Replace with Excel wildcard characters. Here is how to do this:

Select the data where you want to find and replace text. Go to Home –> Find & Select –> Go To. This will open the Find and Replace dialogue box. (You can also use the keyboard shortcut – Control + H). Enter the following text in the find and replace dialogue box: Find what: NorthW Replace with: North-West  Click on Replace All.

This will instantly change all the different formats and make it consistent to North-West.

How does this Work? In the Find field, we have used NorthW which will find any text that has the word North and contains the alphabet ‘W’ anywhere after it. Hence, it covers all the scenarios (NorthWest, North West, and North-West). Find and Replace finds all these instances and changes it to North-West and makes it consistent.

4. Count Non-blank Cells that Contain Text

I know you are smart and you thinking that Excel already has an inbuilt function to do this. You’re absolutely right!! This can be done using the COUNTA function. BUT… There is one small problem with it. A lot of times when you import data or use other people’s worksheet, you will notice that there are empty cells while that might not be the case. These cells look blank but have =”” in it. The trouble is that the The trouble is that the COUNTA function does not consider this as an empty cell (it counts it as text). See the example below:

In the above example, I use the COUNTA function to find cells that are not empty and it returns 11 and not 10 (but you can clearly see only 10 cells have text). The reason, as I mentioned, is that it doesn’t consider A11 as empty (while it should). But that is how Excel works. The fix is to use the Excel wildcard character within the formula. Below is a formula using the COUNTIF function that only counts cells that have text in it: This formula tells excel to count only if the cell has at least one character. In the ?* combo:

? (question mark) ensures that at least one character is present. * (asterisk) makes room for any number of additional characters.

Note: The above formula works when only have text values in the cells. If you have a list that has both text as well as numbers, use the following formula: Similarly, you can use wildcards in a lot of other Excel functions, such as IF(), SUMIF(), AVERAGEIF(), and MATCH(). It’s also interesting to note that while you can use the wildcard characters in the SEARCH function, you can’t use it in FIND function. Hope these examples give you a flair of the versatility and power of Excel wildcard characters. If you have any other innovative way to use it, do share it with me in the comments section. You May Find the Following Excel Tutorials Useful:

Using COUNTIF and COUNTIFS with Multiple Criteria. Creating a Drop Down List in Excel. Intersect Operator in Excel

  1. Excel document contains 1000 rows with URI patterns in Column A – a. website.com/path1/###### – b. website.com/path1/######/path2 – c. website.com/path1/######?query – d. website.com/path1/######/path2?query – e. website.com/path1/path2/###### – f. website.com/path1/path2/######/path3 – g. website.com/path1/path2/######?query – h. website.com/path1/path2/######/path3?query
  2. I must extract the “/#######” pattern (exactly 8 characters) in column B as a single formula.
  3. I tried various wildcard lookups / find / search /array / match with only partial success.