Locating specific data within fragmented, inconsistent spreadsheets often leads to significant manual reconciliation delays. While standard funding sources and corporate budget databases rely on rigid data structures, real-world reporting demands adaptability. Leveraging wildcard-enabled formulas grants analysts the immediate capability to bypass strict matching rules and uncover hidden data connections. However, under the stipulation that improper wildcard syntax can yield inaccurate duplicates, establishing precise search parameters is critical. For example, using the asterisk (*) wildcard in a SEARCH or XLOOKUP formula easily isolates "Corp" from "Global Corporation." Below, we outline the exact formulas required to execute these partial matches efficiently.
Excel is an incredibly powerful tool for data analysis, but real-world data is rarely clean or perfectly uniform. Quite often, you need to find and retrieve data based on incomplete information. For instance, you might want to look up a transaction using only a partial serial number, find a customer's details using only their last name, or locate a product when you only know a portion of its title.
This is where partial matching comes into play. By using Excel's built-in wildcards within your lookup formulas, you can search for text strings that contain, start with, or end with your target search term. In this comprehensive guide, we will explore how to perform partial matches using various Excel functions, including XLOOKUP, VLOOKUP, INDEX & MATCH, and text-searching functions like SEARCH and FIND.
Before diving into the formulas, it is essential to understand the three wildcard characters that Excel supports. These characters act as placeholders in your search criteria:
*): Represents any number of characters (including zero characters). For example, searching for *east* will find "Northeast", "Southeast", "Eastern", or simply "east".?): Represents exactly one single character. For example, searching for Sm?th will find "Smith" or "Smyth", but it will not match "Smithe".~): Acts as an escape character. If you need to search for an actual asterisk or question mark in your data, you must place a tilde before it (e.g., ~* or ~?).If you are using Microsoft 365 or Excel 2021 and newer, XLOOKUP is the most robust and flexible tool for lookups. By default, XLOOKUP performs an exact match search. However, it features a dedicated argument that explicitly enables wildcard matching.
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode])
To use wildcards, you must set the fifth argument, match_mode, to 2. This tells Excel that your search term contains wildcard characters.
Imagine you have a list of product IDs in column A (e.g., "TX-1002-PRO", "CA-2005-ENT") and their corresponding prices in column B. You want to find the price of the product containing "2005" using a search term in cell D2.
Your formula would look like this:
=XLOOKUP("*" & D2 & "*", A2:A10, B2:B10, "Not Found", 2)
How it works:
&) builds the lookup value. If D2 contains "2005", Excel evaluates the lookup value as "*2005*".A2:A10 that has "2005" anywhere inside it.match_mode argument to 2 instructs XLOOKUP to interpret the asterisks as wildcards rather than literal text.For users on older versions of Excel, or those working in environments where backward compatibility is crucial, VLOOKUP remains a reliable option. VLOOKUP natively supports wildcard characters when performing an exact match (where the fourth argument is set to FALSE or 0).
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Suppose you have a customer database. Column A contains the full name (e.g., "Johnathan Davis") and Column B contains their email address. You want to retrieve the email address by searching for "John" in cell D2.
The formula to use is:
=VLOOKUP("*" & D2 & "*", A2:B100, 2, FALSE)
Key Considerations for VLOOKUP:
"*" & D2 & "*". If you write "*D2*", Excel will literally search for the text "D2" instead of the value inside cell D2.FALSE. Even though we are doing a "partial" match, we are instructing Excel to find an exact pattern match to our wildcard string.VLOOKUP can only search the leftmost column of your specified range. If your search terms are in Column B and you want to return values from Column A, VLOOKUP cannot do this without restructuring your sheet.If you need to perform a partial match lookup but your return column is to the left of your search column, or if you want a more dynamic formula than VLOOKUP, the combination of INDEX and MATCH is the classic industry standard.
=INDEX(return_range, MATCH("*" & search_term & "*", search_range, 0))
Suppose your item descriptions are in Column B and their corresponding part numbers are in Column A. You want to find the part number for an item description containing "Cordless".
=INDEX(A2:A50, MATCH("*" & "Cordless" & "*", B2:B50, 0))
How it works:
MATCH function searches B2:B50 for any string containing "Cordless". The third argument of MATCH is set to 0 (exact match), which is required for wildcard processing.MATCH identifies the row number (e.g., row 5), the INDEX function retrieves the value from that exact row within Column A.Sometimes you don't want to pull values from another column; instead, you simply want to identify if a specific cell contains a substring. You can achieve this by combining ISNUMBER with either the SEARCH or FIND function.
SEARCH does not care about capital letters. Searching for "apple" will match "Apple", "APPLE", or "apple".FIND is strictly case-sensitive. Searching for "apple" will not match "Apple".To verify if cell A2 contains the text "urgent", use the following formula:
=ISNUMBER(SEARCH("urgent", A2))
If "urgent" is found inside A2, the SEARCH function returns its starting character position (a number). ISNUMBER then converts this numerical position to TRUE. If the text is not found, SEARCH returns a #VALUE! error, which ISNUMBER evaluates as FALSE.
You can wrap this within an IF statement to categorize your data dynamically:
=IF(ISNUMBER(SEARCH("urgent", A2)), "High Priority", "Normal")
When working with wildcards and partial matches in Excel, you might run into unexpected errors. Here are the most common issues and how to resolve them:
If your formula returns a #N/A error, double-check the following:
XLOOKUP, ensure you have set the match_mode parameter to 2. If omitted, Excel defaults to an exact match.VLOOKUP and MATCH, ensure your match type is set to FALSE or 0.Because wildcards match broad patterns, Excel will return the first matching occurrence it encounters in your range. If you search for "*Mini*", Excel will stop at "iPad Mini" even if you were looking for "Mac Mini" further down the list. If you have duplicate matches, consider cleaning your data or using a filter function to extract all occurrences.
Wildcards only work with text data. If you try to use wildcards on formatted numbers (like searching for a partial ZIP code or phone number stored as numerical data), Excel lookup functions will fail to find a match. To resolve this, you must convert your numbers to text, or use the TEXT function within your lookup array.
| Objective | Formula Example | Best Used For |
|---|---|---|
| Modern partial lookup (any direction) | =XLOOKUP("*"&D2&"*", A:A, B:B, "No Match", 2) |
Excel 365/2021 users seeking simplicity. |
| Traditional rightward partial lookup | =VLOOKUP("*"&D2&"*", A:B, 2, FALSE) |
Standard backward-compatible sheets. |
| Flexible partial lookup (any direction) | =INDEX(B:B, MATCH("*"&D2&"*", A:A, 0)) |
Complex models needing non-adjacent ranges. |
| Logical test for partial presence | =ISNUMBER(SEARCH("text", A2)) |
Conditional formatting or IF statements. |
Mastering partial matches with wildcards can save you hours of manual data cleaning and searching. Whether you adopt the modern capabilities of XLOOKUP, rely on the robust dependability of VLOOKUP or INDEX/MATCH, or run quick checks with SEARCH, understanding how to construct dynamic criteria with asterisks and question marks is an invaluable asset for any Excel analyst.
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.