Locating specific records in Excel when dealing with incomplete or inconsistent text data is a common, frustrating hurdle. While standard search functions offer a baseline for exact matches, they fall short when handling messy datasets. Implementing wildcard characters-such as the asterisk (*)-grants users the powerful ability to isolate partial strings instantly. As a crucial stipulation, ensure your target data is formatted as text, as wildcards do not natively support numeric values. For example, applying =XLOOKUP("*North*", A:A, B:B, , 2) easily extracts "North America" sales. Below, we examine the essential formulas to master these dynamic searches.
In Microsoft Excel, finding exact matches is a straightforward process. But what happens when the data you are dealing with is inconsistent, incomplete, or contains minor variations? For instance, you might need to locate a transaction using only a partial reference code, search for a client name using just their last name, or categorize products using shared text patterns within their descriptions.
This is where partial matching becomes an essential skill. By combining classic Excel lookup functions with wildcard characters, you can build dynamic, flexible formulas capable of finding exactly what you need, even when your search criteria are incomplete. In this comprehensive guide, we will explore how to master partial matches using wildcards in Excel.
Before diving into complex formulas, it is crucial to understand the tools that make partial matching possible. Excel supports three primary wildcard characters:
*): Represents any sequence of characters, including zero characters. For example, searching for *east* will match "Northeast", "Southeast", "Eastern", and "northeast-region".?): Represents any single, individual character. For example, searching for b?ll will match "ball", "bell", "bill", and "bull", but not "bellhop" or "bl".~): Acts as an escape character. If you need to search for an actual asterisk or question mark in your sheet without Excel treating them as wildcards, you place a tilde before them (e.g., ~? or ~*).The VLOOKUP function is one of the most widely used functions in Excel. To perform a partial match with VLOOKUP, you must concatenate the asterisk wildcard to your lookup value and ensure that the match type argument is set to FALSE (or 0) for an exact match. (Note: Even though we are doing a partial match, Excel treats the wildcard expression itself as the value to match exactly).
=VLOOKUP("*" & lookup_value & "*", table_array, col_index_num, FALSE)
Imagine you have a product catalog in range A2:B10 where column A contains long descriptions like "Ultra High Definition 4K Monitor - 27 inch" and column B contains prices. You want to look up the price of the "Monitor" by just typing "Monitor" in cell D2.
| Product Description (Col A) | Price (Col B) |
|---|---|
| Wireless Ergonomic Keyboard | $45.00 |
| Ultra High Definition 4K Monitor - 27 inch | $299.99 |
| USB-C Multiport Adapter Hub | $34.50 |
To find the price of the monitor, write the following formula in your cell:
=VLOOKUP("*" & D2 & "*", A2:B10, 2, FALSE)
How it works: The formula evaluates the lookup value to "*Monitor*". Excel searches column A for any text string containing "Monitor" anywhere inside it, finds the second row, and returns the corresponding price of $299.99.
If you are using Excel 365 or Excel 2021, the XLOOKUP function offers a more robust, flexible alternative to VLOOKUP. Unlike VLOOKUP, which automatically supports wildcards when performing exact matches, XLOOKUP requires you to explicitly enable wildcard matching by utilizing its match_mode argument.
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode])
To use wildcards, you must set the match_mode argument to 2.
Using the same product example, to look up the price of "Monitor" in cell D2 using XLOOKUP, use this formula:
=XLOOKUP("*" & D2 & "*", A2:A10, B2:B10, "Not Found", 2)
Why XLOOKUP is superior:
[if_not_found] parameter.For legacy spreadsheets or scenarios requiring maximum performance and structural flexibility, the classic combination of INDEX and MATCH is the go-to solution. Like VLOOKUP, the MATCH function natively supports wildcards when its search type parameter is set to 0.
=INDEX(return_range, MATCH("*" & lookup_value & "*", lookup_range, 0))
If your product names are in column B and prices are in column A (a setup VLOOKUP cannot easily handle without rearranging columns), you can find your item price with:
=INDEX(A2:A10, MATCH("*" & D2 & "*", B2:B10, 0))
Sometimes you don't want to extract a single value, but rather check if a cell contains a specific substring as part of a larger conditional structure, or filter a list. You can achieve this using the COUNTIF or ISNUMBER/SEARCH combinations.
The COUNTIF function counts the number of cells in a range that meet a specified criterion. By wrapping your query in wildcards, you can check if a specific string exists within a cell:
=IF(COUNTIF(A2, "*Monitor*") > 0, "Contains Monitor", "Does not contain")
If you want to extract *all* matches from a list instead of just the first occurrence, the FILTER function paired with ISNUMBER and SEARCH is the modern standard. While SEARCH doesn't strictly need wildcard characters because it inherently searches for substrings, it functions as the logical equivalent for array processing.
=FILTER(A2:B10, ISNUMBER(SEARCH(D2, A2:A10)), "No results found")
This formula evaluates every row in the array A2:A10. If "Monitor" (stored in D2) is found anywhere inside a description, SEARCH returns its starting position (a number), ISNUMBER returns TRUE, and FILTER returns the matching rows.
While wildcards make Excel lookups incredibly powerful, they can lead to unexpected errors if not implemented with care. Keep the following best practices in mind:
If your lookup cell (e.g., cell D2) is completely empty and your formula is built as "*" & D2 & "*", the search string collapses into "". In Excel, this acts as a catch-all wildcard that will match the very first non-empty text value in your target column. This can lead to misleading results. You can prevent this by wrapping your formula in an IF statement:
=IF(D2="", "", XLOOKUP("*" & D2 & "*", A2:A10, B2:B10, "Not Found", 2))
Wildcard characters only work with text data types. If your lookup column contains actual numbers (e.g., serial numbers formatted as numbers rather than text), standard wildcard lookup formulas will return #N/A. To circumvent this, convert your numeric column to text inside the formula using the TEXT function, or concatenate empty strings:
=MATCH("*" & D2 & "*", A2:A10 & "", 0)
Note: Concatenating arrays with empty strings may require entering the formula as an array formula (Ctrl+Shift+Enter) in older Excel versions.
Standard lookup functions like VLOOKUP, XLOOKUP, and MATCH are case-insensitive. This means searching for "*monitor*" will return results matching "Monitor", "MONITOR", and "mOnItOr". If you require case-sensitive partial matching, you must leverage functions designed for case sensitivity, such as FIND (which is case-sensitive, unlike SEARCH) combined with an INDEX/MATCH array formula.
Mastering partial matches using wildcard characters transforms Excel from a rigid database search tool into a highly flexible data-cleansing and analysis engine. Whether you are using classic functions like VLOOKUP or the ultra-modern XLOOKUP, understanding how to construct and escape wildcards ensures that dirty data, partial records, and typos will never stand in the way of extracting accurate insights from your spreadsheets.
Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.