How to XLOOKUP Partial Match in Excel: Easy Guide
When working with Excel, you often deal with data that doesn’t match perfectly such as customer names, product codes, or text entries that only partially match. The XLOOKUP function can handle partial matches easily when combined with wildcards.
In this guide, we will show you exactly how to use XLOOKUP for partial matches with step-by-step explanations, practical examples, and formula variations.
When You Need a Partial Match
Partial matches are useful when your lookup value doesn’t exactly match the lookup array entries.
Example Scenarios:
- Searching for “Pro” to find “Product A”
- Finding a customer by a part of their name (like “Smith” for “John Smith”)
- Matching partial item codes (e.g., “A10” for “A1001”)
Without using wildcards, XLOOKUP looks for exact matches only. Let’s see how to enable partial matching.
Using XLOOKUP with Wildcards for Partial Match
Excel supports two wildcard characters in XLOOKUP:
Wildcard | Meaning | Example |
---|---|---|
* | Represents any number of characters | "Pro*" matches “Product”, “Program” |
? | Represents a single character | "A?C" matches “ABC”, “AXC” |
Example 1: Partial Match Using Asterisk (*)
Let’s say you have the following dataset:
Product Code | Price |
---|---|
A1001 | $25 |
A1050 | $30 |
B2001 | $45 |
If you want to look up a product code that starts with “A10”, you can use:
=XLOOKUP("A10*", A2:A4, B2:B4, "Not Found", 2)
Explanation:
"A10*"
tells Excel to find any value beginning with “A10”.A2:A4
is the lookup array.B2:B4
is the return array."Not Found"
displays if no match is found.- The
2
in[match_mode]
means wildcard match.
This will return $25 because “A1001” is the first partial match for “A10”.
Example 2: Partial Match Containing Text
If you want to find a match where the lookup text is anywhere within the cell, you can use the wildcard *
before and after your lookup value.
Formula:
=XLOOKUP("*"&"100"&"*", A2:A4, B2:B4, "Not Found", 2)
Explanation:
- The formula looks for “100” anywhere inside the text of cells in
A2:A4
. - The
&
symbol concatenates wildcards before and after the search text. - Returns the price for the first item that includes “100” in the product code.
This will return $25 because “A1001” includes “100”.
Example 3: Partial Match Using Cell Reference
If your lookup value is stored in a cell (say C2 contains A10
), you can use:
=XLOOKUP(C2 & "*", A2:A4, B2:B4, "Not Found", 2)
This formula makes it flexible to change the lookup value without editing the formula each time.
Understanding Match Mode Options
The [match_mode]
argument in XLOOKUP determines how Excel searches for matches:
Match Mode | Description |
---|---|
0 | Exact match (default) |
-1 | Exact match or next smaller item |
1 | Exact match or next larger item |
2 | Wildcard match |
To perform partial matches, you must set match_mode to 2.
How XLOOKUP Handles Wildcards Internally
When match_mode
is set to 2, Excel treats the lookup_value as a text pattern. It interprets *
and ?
as wildcard symbols. If your lookup value actually contains these symbols and you want them treated literally (not as wildcards), you’ll need to escape them using the tilde (~) symbol.
Example:
=XLOOKUP("A~*10", A2:A4, B2:B4, "Not Found", 2)
This will look for “A*10” exactly, not as a wildcard pattern.
Using XLOOKUP for Partial Text in Names
Imagine you have a list of customer names and you want to find someone by a partial name.
Customer Name | City |
---|---|
John Smith | Dallas |
David Brown | Austin |
Lisa Johnson | Houston |
To find the city for a name containing “Smith”, use:
=XLOOKUP("*Smith*", A2:A4, B2:B4, "Not Found", 2)
This returns Dallas since the function matches “John Smith”.
Combining XLOOKUP with Functions for Flexible Partial Matches
Sometimes you need case-insensitive, contains-based, or dynamic matches beyond simple wildcards. You can combine XLOOKUP with other Excel functions like SEARCH, FILTER, or IFERROR for more flexibility.
Example 1: Using SEARCH with XLOOKUP
You can simulate a “contains” match using SEARCH and FILTER, then wrap it inside XLOOKUP.
=XLOOKUP(TRUE, ISNUMBER(SEARCH(C2, A2:A10)), B2:B10, "Not Found")
How it works:
SEARCH(C2, A2:A10)
returns a number if C2 is found within each cell.ISNUMBER
converts that to TRUE/FALSE.XLOOKUP
finds the first TRUE and returns the matching value fromB2:B10
.
This method doesn’t require wildcards and is case-insensitive.
Example 2: Using IFERROR to Handle Missing Matches
To avoid Excel errors like #N/A
, use IFERROR:
=IFERROR(XLOOKUP("*"&C2&"*", A2:A10, B2:B10, , 2), "No Match Found")
This keeps your sheet clean by returning a custom message instead of an error.
XLOOKUP vs. VLOOKUP for Partial Matches
While VLOOKUP can also perform partial matches using wildcards, XLOOKUP is more advanced and efficient.
Feature | XLOOKUP | VLOOKUP |
---|---|---|
Works both directions | Yes | No |
Supports wildcards | Yes | Yes |
Handles missing values | Yes (with if_not_found ) | No |
Allows dynamic range lookup | Yes | No |
Easier to read | Yes | No |
Verdict: XLOOKUP is faster, cleaner, and easier for partial matching tasks.
Real-Life Example: Product Lookup with Partial Codes
Let’s look at a practical scenario.
Product Code | Product Name | Price |
---|---|---|
P-100-A | Keyboard | $25 |
P-200-B | Mouse | $15 |
P-300-C | Monitor | $150 |
P-400-D | Laptop | $850 |
You have a partial code in cell E2
(e.g., P-3
) and want to find the Product Name.
Formula:
=XLOOKUP(E2 & "*", A2:A5, B2:B5, "Not Found", 2)
Result: Monitor
If you wanted the Price instead, replace B2:B5
with C2:C5
:
=XLOOKUP(E2 & "*", A2:A5, C2:C5, "Not Found", 2)
Result: $150
How to Search from Last to First Match
If your data has multiple partial matches and you want to return the last match, you can use the [search_mode]
argument.
Search Mode | Description |
---|---|
1 | Search from first to last (default) |
-1 | Search from last to first |
Example:
=XLOOKUP("*"&C2&"*", A2:A10, B2:B10, "Not Found", 2, -1)
This finds the last item containing the text from C2.
Common Errors When Using XLOOKUP Partial Match
Here are a few mistakes to avoid:
Error Type | Cause | Solution |
---|---|---|
#N/A | No match found | Use if_not_found or wrap with IFERROR |
Wrong result | Forgot wildcard symbols | Add * or ? properly |
Text not matching | Match mode not set to 2 | Always use ,2 for wildcard match |
Literal * or ? treated as wildcard | Excel reads it as pattern | Use ~ before special character |
Pro Tips for Using XLOOKUP Partial Match Effectively
- Always define match_mode as 2 when using wildcards.
- Combine
*
before and after text to find values containing a substring. - Use cell references for dynamic lookups.
- Wrap with IFERROR to handle missing data gracefully.
- For multiple partial matches, use FILTER instead of XLOOKUP.
- When you expect duplicates, add
[search_mode] = -1
to find the last match.
Final Thoughts
The XLOOKUP partial match feature makes searching flexible and efficient in Excel. By combining wildcards (*
and ?
) and setting the match_mode to 2, you can easily find text fragments, partial product codes, or incomplete data.
Once you’re comfortable with wildcards, you can even pair XLOOKUP with functions like SEARCH or FILTER for more advanced lookups; making it one of the most powerful tools in modern Excel.
FAQs
What is a partial match with XLOOKUP?
A partial match finds a cell that contains part of your lookup text. With XLOOKUP you use wildcards like *
and ?
and set match_mode
to 2
to enable partial matching.
How do I use wildcards with XLOOKUP?
Add *
before and/or after your lookup value (for example "*text*"
), or use ?
for single characters. Use XLOOKUP(lookup_value, lookup_array, return_array, if_not_found, 2)
so Excel treats the lookup as a pattern.
Can XLOOKUP find text anywhere inside a cell?
Yes. To match text anywhere in a cell, wrap the lookup text with wildcards like *
. Example: =XLOOKUP("*"&C2&"*", A2:A10, B2:B10, "Not Found", 2)
.
What if multiple rows match my partial lookup?
XLOOKUP returns the first match by default. To get the last match instead, add the search_mode
argument with -1
(for example: XLOOKUP(..., 2, -1)
). If you need all matches, use FILTER
instead.
How do I avoid #N/A when no partial match exists?
Use the if_not_found
argument inside XLOOKUP or wrap the formula with IFERROR
. Example: =XLOOKUP("*"&C2&"*", A2:A10, B2:B10, "No Match", 2)
or =IFERROR(..., "No Match")
.
Can I do case-insensitive partial matches with XLOOKUP?
XLOOKUP’s wildcard match is not case sensitive. For more control, you can use SEARCH
with ISNUMBER
inside XLOOKUP, for example: =XLOOKUP(TRUE, ISNUMBER(SEARCH(C2, A2:A10)), B2:B10, "Not Found")
.

Vaishvi Desai is the founder of Excelsamurai and a passionate Excel enthusiast with years of experience in data analysis and spreadsheet management. With a mission to help others harness the power of Excel, Vaishvi shares her expertise through concise, easy-to-follow tutorials on shortcuts, formulas, Pivot Tables, and VBA.