Back to all formula guides
7 min readβ€’β€’Gridverse Team

XLOOKUP Wildcard in Excel: How to Do a Partial Match

Master the XLOOKUP wildcard in Excel with exact formula examples. Learn how to fix #N/A with match_mode 2 and search partial text strings with Celdi.

client_directory.xlsx
D2fx
#A Β· Client NameB Β· Invoice TotalC Β· Partial SearchD Β· Result
2Acme Global Logistics$1,420.00Peak#N/A
3Apex Retail Labs$850.00β€”β€”
4Peak Dynamics LLC$3,100.00β€”β€”
5Vortex Audio Inc$620.00β€”β€”
Adding match_mode 2 to enable wildcard search...Gridverse Excel Engine

Typing =XLOOKUP("*" & C2 & "*", A2:A10, B2:B10) into cell D2 returns an immediate #N/A error in modern Microsoft Excel and Google Sheets, even when your lookup table clearly contains the matching substring. Unlike legacy spreadsheet lookup formulas that silently enabled pattern matching, modern vector lookups treat asterisk and question mark characters as literal text by default. Without an explicit configuration instruction, Excel scans column A searching for the literal string *Peak* instead of treating the asterisks as flexible pattern wildcards.

Activating partial text matching in XLOOKUP requires unlocking the optional fifth argument: match_mode. Passing the parameter value 2 instructs Excel’s calculation engine to evaluate asterisks (*) as any sequence of characters and question marks (?) as single-character placeholders. This single configuration switch converts a failing lookup into a resilient text search engine capable of matching invoice prefixes, supplier legal variations, and fragmented customer names.

Wildcard Lookup Dataset Example

The formulas throughout this guide evaluate the customer accounts receivable ledger displayed below in worksheet range A1:D5. The master column lists full legal registered entity names, while staff members search using informal shorthand fragments in cell F2:

Row Col A (Client Name) Col B (Account Code) Col C (Invoice Total) Col D (Account Status)
1 Full Legal Entity Ledger ID Outstanding Balance Credit State
2 Acme Global Logistics Inc ACC-1042 $1,420.00 Active
3 Apex Retail Labs Corp ACC-2098 $850.00 Review
4 Peak Dynamics LLC ACC-3814 $3,100.00 Active
5 Vortex Audio Systems Ltd ACC-4105 $620.00 Cleared

If a billing clerk inputs "Peak" into search cell F2, a standard exact lookup fails because "Peak" does not match "Peak Dynamics LLC" character for character. Evaluating the pattern requires concatenating dynamic wildcard symbols and configuring match_mode = 2.

Visual Syntax Breakdown: Unlocking Parameter 5 in XLOOKUP

The complete architectural syntax for performing a wildcard lookup with built-in fallback defense follows this structure:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • lookup_value: The text pattern containing wildcard characters (e.g., "*" & F2 & "*", "INV-????", or F2 & "*").
  • lookup_array: The target column containing strings to evaluate (A2:A5).
  • return_array: The column containing values to return upon locating a match (C2:C5 or B2:D5).
  • [if_not_found]: The defensive fallback value returned when no substring matches (e.g., "No client match"), eliminating downstream formula breaks.
  • [match_mode]: The critical fifth parameter. You must explicitly pass 2 to enable wildcard character matching (0 = exact match, -1 = exact or next smaller, 1 = exact or next larger, 2 = wildcard match).
XLOOKUP wildcard and partial match syntax anatomy diagram showing parameter 5 match_mode 2
Figure 1: Anatomy of an XLOOKUP wildcard formula. Passing 2 into argument 5 enables pattern matching and prevents #N/A errors.

The 3 Wildcard Operators in Excel Spreadsheets

Excel formulas recognize three dedicated wildcard operators when evaluated under pattern matching mode:

  1. Asterisk (*): Matches any sequence of characters, including zero characters. Placing asterisks on both ends of a search string ("*" & F2 & "*") matches anywhere within the cell text (e.g., "Dynamics" finds "Peak Dynamics LLC").
  2. Question Mark (?): Matches exactly one single character in a fixed position. Searching for "ACC-????" matches four-digit account codes like "ACC-1042" while ignoring five-digit strings.
  3. Tilde (~): Acts as an escape operator when searching for literal asterisks, question marks, or tildes. If an item code contains a real asterisk like "PROD*99", prefixing the character with a tilde ("PROD~*99") forces Excel to treat the symbol as text rather than a wildcard.

4 Practical Wildcard Lookup Scenarios

1. Contains Substring Match (Search Anywhere in Cell)

Problem: Cell F2 contains the partial text "Dynamics". Retrieve the corresponding invoice balance from column C regardless of where the word appears in the full corporate name.

=XLOOKUP("*" & F2 & "*", A2:A5, C2:C5, "Not found", 2)

Step-by-step formula execution:

  1. Excel evaluates "*" & F2 & "*" into the unified text string "*Dynamics*".
  2. Argument 4 ("Not found") defines a clean fallback if no match exists.
  3. Argument 5 (2) informs the calculation engine that asterisks represent arbitrary prefix and suffix characters.
  4. Excel scans A2:A5, identifies "Peak Dynamics LLC" on row 4, and extracts $3,100.00 from column C.

If you are upgrading legacy models built around older table search formulas, read our benchmark comparison between XLOOKUP vs VLOOKUP to understand how modern formulas avoid index tracking mistakes.

2. Starts With Prefix Match (Fixed Code Stems)

Problem: Identify the account balance for an entity whose name begins with "Apex", ensuring names with "Apex" embedded in the middle are ignored.

=XLOOKUP(F2 & "*", A2:A5, C2:C5, "Prefix missing", 2)

Appending the asterisk only to the right side of the input cell creates an anchor at the beginning of the text string. Row 3 ("Apex Retail Labs Corp") matches successfully, whereas a hypothetical company named "Global Apex Systems" is skipped.

3. Fixed-Length Pattern Matching with Question Marks

Problem: Verify client ledger codes that follow an exact four-digit numeric sequence after the "ACC-" prefix.

=XLOOKUP("ACC-????", B2:B5, A2:A5, "Invalid code format", 2)

The four question mark placeholders enforce strict positional length validation. If a record contains "ACC-104", it fails the four-character requirement and returns the defensive fallback message.

When missing values cause entire reporting lines to display error indicators, review our troubleshooting guide on how to fix the #N/A error in Excel.

4. Returning Multiple Columns from a Single Wildcard Match

Problem: When a partial customer match occurs, extract both the ledger ID in column B and the outstanding balance in column C simultaneously into adjacent cells without writing duplicate lookup formulas.

=XLOOKUP("*" & F2 & "*", A2:A5, B2:C5, "Record not found", 2)

Because modern spreadsheet engines support dynamic array spilling, referencing a multi-column return array (B2:C5) causes the matched ledger ID and dollar amount to populate columns G and H in a single calculation step.

If your spreadsheet requires filtering rows based on multiple logical criteria simultaneously, explore our guide on XLOOKUP with multiple criteria and our overview of the FILTER function with multiple criteria.

Partial Match Formula Comparison: XLOOKUP vs Legacy Methods

Spreadsheet professionals historically relied on several workarounds to execute partial string searches. Here is how modern wildcard XLOOKUP compares with previous spreadsheet patterns:

Technique Formula Syntax Requires Wildcard Mode? Left-to-Right Only? Built-in Fallback?
XLOOKUP Wildcard =XLOOKUP("*"&F2&"*", A:A, B:B, "β€”", 2) Yes (Parameter 5 = 2) No (Searches any direction) Yes (Parameter 4)
VLOOKUP Wildcard =VLOOKUP("*"&F2&"*", A:C, 3, FALSE) Automatic with FALSE Yes (Lookup column must be 1st) No (Requires IFERROR)
INDEX + MATCH =INDEX(B:B, MATCH("*"&F2&"*", A:A, 0)) Automatic with MATCH 0 No No (Requires IFERROR)
SEARCH + FILTER =FILTER(B:B, ISNUMBER(SEARCH(F2, A:A))) No (Uses substring math) No Yes (if_empty argument)

While legacy formulas like VLOOKUP supported wildcards automatically when exact match (FALSE) was selected, they break if columns shift and force users to wrap expressions in how to use IFERROR in Excel. For complex matrix lookups that evaluate both rows and columns dynamically, read our detailed tutorial on two-way matrix lookup with XLOOKUP.

Practice Wildcard Lookups Interactively in Gridverse

Reading syntax documentation helps clarify formula arguments, but building speed and confidence on technical corporate assessments requires active problem-solving drills. Missing the fifth argument or forgetting to wrap literal wildcard strings in quotation marks under exam conditions costs candidates valuable test score points.

In the Gridverse mobile app, you snap formulas together using modular LEGO-style syntax blocks. You can practice partial match lookups, debug broken formula workbooks, and conquer Error Boss Battles in 5-minute interactive sessions with Celdi, your personal spreadsheet companion. Download Gridverse on iOS and Android to turn spreadsheet mastery into an intuitive daily habit.

Frequently Asked Questions (FAQ)

Why does XLOOKUP return #N/A when using wildcards?

XLOOKUP defaults to exact match mode (match_mode = 0), which searches for the literal text characters * or ?. To evaluate asterisks as wildcards, you must explicitly supply 2 as the fifth argument: =XLOOKUP("*" & F2 & "*", A2:A10, B2:B10, "Not found", 2).

Can XLOOKUP match text if the case does not match?

Yes. XLOOKUP is case-insensitive by default in both Excel and Google Sheets. Searching for "*dynamics*" matches "Peak Dynamics LLC" and "PEAK DYNAMICS LLC" identically.

How do I search for a literal asterisk or question mark in XLOOKUP?

To search for a literal asterisk or question mark inside a cell without triggering pattern substitution, precede the character with a tilde (~). For example, searching for "PROD~*10" finds cells containing the exact text "PROD*10".

Does XLOOKUP wildcard matching work in Google Sheets?

Yes. Google Sheets supports identical syntax for wildcard matching in XLOOKUP. You must still include the fifth parameter 2 to activate wildcard behavior.