ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Lookups
  3. XLOOKUP Wildcards and Match Modes Explained

XLOOKUP Wildcards and Match Modes Explained

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

XLOOKUP uses wildcards only when its 5th argument, match_mode, is 2: =XLOOKUP("Riverside*",A2:A9,B2:B9,"Not found",2). The * stands for any number of characters and ? for exactly one. Match mode -1 returns an exact match or the next smaller value, and 1 the next larger, which is useful for bands and tiers.

Key takeaways

  • XLOOKUP treats * and ? as normal characters unless match_mode is 2.
  • To reach the 5th argument, fill the 4th with a message or skip it with two commas.
  • ""&H11&"" finds a name that contains the word in H11.
  • XLOOKUP stops at the first match from the top; use search_mode -1 to get the last one.
  • Match mode -1 (next smaller) and 1 (next larger) handle bands without a sorted table.
On this page+
  1. How to use an XLOOKUP wildcard match
  2. The three wildcard characters
  3. Search for a name that contains a word
  4. XLOOKUP returns the first match
  5. How to return every match, not just the first
  6. Match modes -1 and 1: bands and tiers
  7. Wildcards in VLOOKUP, HLOOKUP and MATCH
  8. Common mistakes with XLOOKUP match modes
  9. Practise it

An XLOOKUP wildcard search finds a partial match, like a customer whose name starts with "Riverside", but only if you set the 5th argument, match_mode, to 2. The same argument also handles bands: -1 finds the next smaller value and 1 the next larger. This guide explains each match mode with examples you can type in. XLOOKUP needs Excel 2021, Excel 2024 or Microsoft 365.

How to use an XLOOKUP wildcard match#

Set match_mode to 2, and XLOOKUP reads * and ? as wildcards. Here is a courier desk's customer list:

AB
1CustomerAccount
2Harbor Books LtdAC-2001
3Bluebell FloristsAC-2002
4Northgate DentalAC-2003
5Pixel & Pine StudioAC-2004
6Riverside BakeryAC-2005
7Summit Outdoor GearAC-2006
8Bright Smile DentalAC-2007
9Copper Kettle CafeAC-2008

To find the account of the customer whose name starts with Riverside:

Excel formula
=XLOOKUP("Riverside*",A2:A9,B2:B9,"Not found",2)

The result is AC-2005. Each part has a job:

  • *"Riverside"**: the pattern. The * means "any characters after this".
  • A2:A9 and B2:B9: search the names, bring back the accounts.
  • "Not found": the 4th argument, if_not_found. You need something here (or an empty gap) to reach the 5th.
  • 2: match_mode, wildcard match.

Without the 2, XLOOKUP searches for the exact text "Riverside*", asterisk included, and returns "Not found". You can also skip the 4th argument with two commas: =XLOOKUP("Riverside*",A2:A9,B2:B9,,2). Then a missing name shows #N/A.

The three wildcard characters#

Excel has three wildcard characters, and they work on text only:

CharacterMeansExampleMatches
*Any number of characters, including none"*Dental"Northgate Dental, Bright Smile Dental
?Exactly one character"AC-200?"AC-2001 to AC-2009
~The next character is literal"~*"An actual asterisk

The ? is handy for codes with a fixed shape. "AC-20??" matches any code with exactly two characters after AC-20, like AC-2001 or AC-2099, but not AC-200, which is one character short. Wildcards are case-insensitive, so "riverside*" finds Riverside Bakery too. They don't work on real numbers: a pattern like "20*" won't match the number 2026, only text that starts with 20.

Search for a name that contains a word#

To make the search reusable, put the word in a cell and join asterisks to both sides with &. With "Pine" in H11:

Excel formula
=XLOOKUP("*"&H11&"*",A2:A9,B2:B9,"Not found",2)

The pattern becomes *Pine*, "Pine anywhere in the name", and the result is AC-2004 for Pixel & Pine Studio. Type a different word in H11 and the answer updates. A common slip is writing "*H11*" inside one pair of quotes. That searches for the letters H, 1, 1, not for the word in the cell.

XLOOKUP returns the first match#

When several names fit the pattern, XLOOKUP returns the first one from the top. Two customers have Dental in their name:

  • =XLOOKUP("*Dental*",A2:A9,B2:B9,"Not found",2) returns AC-2003, Northgate Dental.
  • To get Bright Smile Dental, use a pattern only it fits: "Bright*" returns AC-2007.
  • Or search from the bottom with search_mode -1, the 6th argument: =XLOOKUP("*Dental*",A2:A9,B2:B9,"Not found",2,-1) also returns AC-2007.

So check your pattern against the whole list. A loose pattern can return the wrong customer with no error.

How to return every match, not just the first#

XLOOKUP always returns one result. To list every customer that fits a word, use the FILTER function with SEARCH (Excel 2021 or Microsoft 365):

Excel formula
=FILTER(B2:B9,ISNUMBER(SEARCH("Dental",A2:A9)),"None")

SEARCH looks for "Dental" inside each name and returns a position number, or an error when it isn't there. ISNUMBER turns that into TRUE or FALSE, and FILTER keeps the TRUE rows. The result spills into two cells: AC-2003 and AC-2007. SEARCH ignores case, like the wildcards do. The cells below the formula must be empty, or you get #SPILL!.

Match modes -1 and 1: bands and tiers#

Match modes -1 and 1 return a nearby value when there is no exact match. Here is a rate card where each band starts at a weight, and a box list where each box has a maximum weight:

From (kg)RateBoxMax kg
04.50S3
27.00M8
511.00L15
1018.00XL25
2030.00

With the rates in D2:E6, the boxes in D10:E13 and a parcel weight in H2:

  • -1, exact or next smaller, finds the rate band: =XLOOKUP(H2,$D$2:$D$6,$E$2:$E$6,,-1). A 7.5 kg parcel gets 11.00, from the 5 kg band.
  • 1, exact or next larger, finds the smallest box that fits: =XLOOKUP(H2,$E$10:$E$13,$D$10:$D$13,,1). A 7.5 kg parcel gets box M, because 8 is the next limit up.

Unlike VLOOKUP with TRUE, these modes don't need a sorted list. If you work in older Excel, the VLOOKUP approximate match guide covers the TRUE version and its sorting rule.

Wildcards in VLOOKUP, HLOOKUP and MATCH#

Older lookups accept wildcards without any setting. With an exact match, VLOOKUP and HLOOKUP read * and ? in text as wildcards, and so does MATCH with 0:

Excel formula
=VLOOKUP("Riverside*",A2:B9,2,FALSE)

This also returns AC-2005. The difference is that XLOOKUP makes you ask for wildcards, so a real asterisk in your data can't cause a surprise. XMATCH, the modern MATCH, uses the same match modes as XLOOKUP. See our beginner's guide to VLOOKUP and the HLOOKUP guide for the older functions, and the XLOOKUP function guide for a quick reference.

Common mistakes with XLOOKUP match modes#

  • Forgetting match_mode 2. The asterisk is treated as text and you get #N/A or your not-found message.
  • Putting the 2 in the 4th place. =XLOOKUP("Riverside*",A2:A9,B2:B9,2) makes 2 the not-found value, and it does an exact search. Use ,,2 or fill the 4th argument first.
  • A pattern that is too loose. "*a*" matches almost every name. Use a part of the name no other row shares.
  • Mixing up -1 and 1. -1 rounds down to the band that starts below the value. 1 rounds up to the next limit.

Practise it#

Match modes make sense quickly once you see them change the answer. ExcelReady's XLOOKUP wildcards and match modes lesson uses the courier desk from this guide: find accounts by partial names, build a "contains" search from a cell, avoid the first-match trap, then place parcels into rate bands and boxes with -1 and 1. Try the product search on this page, then practise XLOOKUP match modes in a live spreadsheet.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Click E2 and return the price of the product whose name contains the word in E1. Use XLOOKUP on the names in A2:A7 and the prices in B2:B7, join "*" to both sides of E1, add "Not found", and set match_mode to 2.

fx
ABCDEF
1
Product
Price
Search word
Tote
2
Classic Cotton T-shirt
14
Price
3
Zip Hoodie Grey
32
4
Rain Jacket Navy
58
5
Wool Beanie
12
6
Canvas Tote Bag
9
7
Fleece Gloves
11
8
9
10

Tip: The pattern is a "*", then E1, then another "*", joined with &. The 2 goes in the 5th place.

Practise this in a lesson

LessonXLOOKUP wildcards and match modesSearch partial names with XLOOKUP's wildcard mode, and place values into tiers with next-smaller and next-larger matches.Function guideXLOOKUPXLOOKUP explained with real examples: exact matches, looking left and custom not-found messages, plus a live exercise to try now.

Frequently asked questions

Does XLOOKUP support wildcards?

+

Yes, but only when you set match_mode, the 5th argument, to 2. Without it, XLOOKUP looks for a literal asterisk or question mark and usually returns #N/A.

How do I do a contains search with XLOOKUP?

+

Join an asterisk to both sides of the word and use match mode 2: =XLOOKUP(""&H11&"",A2:A9,B2:B9,"Not found",2). It returns the first name that contains the word in H11.

What is the difference between match mode -1 and 1 in XLOOKUP?

+

-1 returns an exact match or, if there isn't one, the next smaller value. 1 returns an exact match or the next larger value. Neither needs the data to be sorted.

How do I search for an actual asterisk with XLOOKUP?

+

Put a tilde before it, like "~*", and use match mode 2. The tilde tells Excel the next character is literal, not a wildcard.

Does VLOOKUP need a match mode for wildcards?

+

No. VLOOKUP with FALSE, and MATCH with 0, accept * and ? in text automatically. XLOOKUP is the one that needs match mode 2.

Sources

  • XLOOKUP function - Microsoft Support
  • XMATCH function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How to use an XLOOKUP wildcard match
  2. The three wildcard characters
  3. Search for a name that contains a word
  4. XLOOKUP returns the first match
  5. How to return every match, not just the first
  6. Match modes -1 and 1: bands and tiers
  7. Wildcards in VLOOKUP, HLOOKUP and MATCH
  8. Common mistakes with XLOOKUP match modes
  9. Practise it

Keep reading

Lookups· 6 min read

VLOOKUP in Excel: Step-by-Step for Beginners

VLOOKUP finds a value in the first column of a table and returns a value from the same row in another column. Write =VLOOKUP(what to find, table, column number, FALSE). FALSE means exact match, which is what you want for IDs, codes and names. If nothing matches, VLOOKUP returns #N/A.

Lookups· 7 min read

VLOOKUP Approximate Match for Tiers and Bands

A VLOOKUP approximate match uses TRUE as the 4th argument, like =VLOOKUP(B2,$F$2:$H$5,3,TRUE). It finds the largest value in the first column that is less than or equal to your number, so 62,000 lands in the band that starts at 50,000. The first column must be sorted from smallest to largest.

Lookups· 7 min read

HLOOKUP in Excel (and When to Use It)

HLOOKUP searches across the top row of a table and returns a value from a row below it: =HLOOKUP(lookup_value, table_array, row_index_num, FALSE). Use it for sideways tables, like a rate card with zones across the top. It is VLOOKUP turned on its side. In Excel 2021 or Microsoft 365, XLOOKUP does the same job more safely.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free