Wicked Smart Data
LearnInsightsAboutContact
Sign InLet's Build
LearnInsightsAboutContact
Sign InLet's Build
Wicked Smart Data

Intelligence, automation, and expert execution — plus an elite library of free knowledge. We turn complexity into competitive advantage.

Start a conversation

Platform

  • Learning Paths
  • Insights
  • RSS Feed

Company

  • About
  • Contact
  • Work With Us

Legal

  • Privacy Policy
  • Terms of Service

© 2026 Wicked Smart Data. All rights reserved.

Intelligence · Automation · Advantage

All Insights
Microsoft Excel

Mastering Excel's XLOOKUP with Multiple Criteria, Wildcards, and Error Handling for Professional-Grade Lookups

Go beyond basic XLOOKUP to master multi-criteria lookups using array concatenation, wildcard fuzzy matching, cascading fallback error handling, and binary search optimization. Build lookup formulas that work reliably at enterprise scale.

🔥 Expert26 min readOct 21, 2026Updated Oct 22, 2026
Mastering Excel's XLOOKUP with Multiple Criteria, Wildcards, and Error Handling for Professional-Grade Lookups
On this page
  • Introduction
  • Prerequisites
  • Understanding XLOOKUP's Full Syntax
  • Single-Criteria XLOOKUP: The Baseline You're Already Past
  • Multi-Criteria XLOOKUP: Array Concatenation Explained
  • How Concatenation Creates a Synthetic Key
  • Returning Multiple Columns at Once
  • The Performance Reality of Full-Column References
  • Wildcard Matching in XLOOKUP: Patterns and Pitfalls
  • Basic Wildcard Lookups
  • Wildcard Matching with Dynamic Lookup Values
  • Combining Wildcards with Multi-Criteria
  • The Wildcard Escape Problem
  • Approximate Match Modes: When Exact Match Isn't Enough
  • Next Smaller Value (`match_mode = -1`)
  • Next Larger Value (`match_mode = 1`)
  • Performance: When to Use Binary Search
  • Professional Error Handling Strategies
  • Understanding the Error Landscape
  • The `if_not_found` Argument vs. IFERROR
  • Contextual Error Messages
  • Cascading Fallback Lookups
  • Using IFNA Instead of IFERROR for Lookup Formulas
  • Advanced Patterns: Nested, Chained, and Bidirectional Lookups
  • Bidirectional (Two-Dimensional) Lookup
  • Returning the Last Match with `search_mode = -1`
  • Horizontal XLOOKUP
  • Chained XLOOKUP for Hierarchical Data
  • XLOOKUP vs. the Alternatives: Making Deliberate Architectural Choices
  • XLOOKUP vs. SUMIFS for Multi-Criteria Aggregation
  • XLOOKUP vs. INDEX-MATCH
  • XLOOKUP vs. FILTER for Multiple-Row Returns
  • Performance Optimization for Large Datasets
  • Benchmark the Baseline
  • Limit Range Size
  • Use Binary Search Where Appropriate
  • Consider Helper Columns for Complex Criteria
  • Manual Calculation Mode for Batch Entry
  • Hands-On Exercise
  • Dataset Setup
  • Exercise Tasks
  • Common Mistakes & Troubleshooting
  • Mistake 1: Forgetting Delimiters in Concatenated Keys
  • Mistake 2: Mismatched Lookup and Return Array Sizes
  • Mistake 3: Using `match_mode = 2` (Wildcard) Without Intending To
  • Mistake 4: Binary Search on Unsorted Data
  • Mistake 5: SPILL Errors in Multi-Column Returns
  • Mistake 6: Case-Sensitive Matching
  • Mistake 7: `if_not_found` Returns the Wrong Data Type
  • Summary & Next Steps
  • Where to Go Next

Mastering Excel's XLOOKUP with Multiple Criteria, Wildcards, and Error Handling for Professional-Grade Lookups

Introduction

Picture this: you're managing a sales dashboard for a regional distribution company. Your dataset has 50,000 rows of transaction records — product codes, region codes, sales rep IDs, dates, and revenue figures. Your manager walks in and asks for the revenue figure for product "PRD-4471" sold in the "Northwest" region by rep "SR-009" in Q3. You could filter manually, you could write a SUMIFS — but the real power move is a single XLOOKUP formula that returns the exact value in under a second, handles the case where it doesn't exist gracefully, and works even when your product codes have inconsistent formatting.

XLOOKUP, introduced in Microsoft 365 and Excel 2021, isn't just a VLOOKUP replacement — it's a fundamentally different lookup architecture. But most Excel users only use its most basic form: a single lookup value against a single column. That's like buying a sports car and only driving it in a parking lot. The true power of XLOOKUP emerges when you combine multiple criteria using array concatenation, deploy wildcards for fuzzy matching, control exact vs. approximate match behavior, and layer in professional error handling that makes your workbooks bulletproof in production environments.

By the end of this lesson, you'll understand XLOOKUP's mechanics at a deep enough level to design lookup formulas you can trust in enterprise workbooks, debug confidently when they fail, and make deliberate architectural choices between XLOOKUP and its alternatives.

What you'll learn:

  • The full XLOOKUP syntax and what each argument actually controls under the hood
  • How to combine multiple criteria with array concatenation and why it works
  • Wildcard matching patterns and the edge cases that will trip you up
  • Professional error handling strategies beyond a simple IFERROR wrapper
  • Performance considerations when running XLOOKUP over large datasets
  • When to use XLOOKUP vs. INDEX-MATCH vs. SUMIFS for multi-criteria scenarios
  • Nested and chained XLOOKUP patterns for complex hierarchical lookups

Prerequisites

This lesson assumes you're comfortable with Excel functions generally, understand the difference between relative and absolute references (if you need a refresher, see Cell References Explained: Relative, Absolute, and Mixed References in Excel), and have at least basic familiarity with what XLOOKUP does. You should also be on Microsoft 365 or Excel 2021 — XLOOKUP is not available in Excel 2019 or earlier. If you're working with an older version, the INDEX-MATCH: The Power User's Alternative to VLOOKUP lesson covers a technique with equivalent power that works across all Excel versions.


Understanding XLOOKUP's Full Syntax

Before we get into advanced patterns, let's nail the full syntax — including the three optional arguments that most users never touch:

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

Most tutorials stop after the first three arguments. Let's look at all six:

lookup_value — What you're searching for. This can be a single value, a cell reference, a concatenated string, or an array of values.

lookup_array — The column (or row) you're searching in. This must be the same size as the return array.

return_array — What you want returned when a match is found. Critically, this can be multiple columns, which means XLOOKUP can replace the "copy the formula across for each column" pattern entirely.

[if_not_found] — The value to return when no match exists. This is XLOOKUP's built-in error handling argument. Default behavior without this argument is to return an #N/A error.

[match_mode] — Controls how matching works:

  • 0 = Exact match (default)
  • -1 = Exact match or next smaller value
  • 1 = Exact match or next larger value
  • 2 = Wildcard match

[search_mode] — Controls the search direction and algorithm:

  • 1 = Search first-to-last (default)
  • -1 = Search last-to-first
  • 2 = Binary search, ascending order
  • -2 = Binary search, descending order

Key insight

The search_mode argument isn't just about direction — it's about algorithm selection. Binary search (2 or -2) is dramatically faster on large sorted datasets, but will return incorrect results if your data isn't actually sorted. This is one of the most dangerous silent failure modes in Excel lookups.

Understanding these six arguments is the foundation for everything that follows. Let's start building complexity.


Single-Criteria XLOOKUP: The Baseline You're Already Past

Let's establish a baseline before we compound the complexity. Here's the scenario we'll build from throughout this lesson:

You're working with a product master table on a sheet called ProductMaster. The columns are:

  • Column A: ProductCode (e.g., "PRD-4471")
  • Column B: Region (e.g., "Northwest")
  • Column C: RepID (e.g., "SR-009")
  • Column D: Quarter (e.g., "Q3-2024")
  • Column E: Revenue (numeric)
  • Column F: Units (numeric)
  • Column G: Status (e.g., "Active", "Discontinued", "Pending")

The basic single-criteria lookup everyone knows:

=XLOOKUP(A2, ProductMaster!A:A, ProductMaster!E:E, "Not Found")

This finds the first product code in column A that matches A2 and returns its revenue. Straightforward. The problem: your dataset has multiple rows with the same product code — one per region, per rep, per quarter. This formula will only ever return the first match, which is almost never what you want in a real business scenario.

This is exactly where multi-criteria lookups become essential.


Multi-Criteria XLOOKUP: Array Concatenation Explained

The most powerful and widely misunderstood technique in XLOOKUP is using array concatenation to combine multiple criteria into a single lookup. Here's the pattern:

=XLOOKUP(A2&B2&C2&D2, 
         ProductMaster!A:A&ProductMaster!B:B&ProductMaster!C:C&ProductMaster!D:D, 
         ProductMaster!E:E, 
         "Not Found")

Let me explain exactly what's happening here, because understanding the mechanics will help you debug it when it breaks.

How Concatenation Creates a Synthetic Key

When you write A2&B2&C2&D2, Excel creates a single text string that looks like "PRD-4471NorthwestSR-009Q3-2024". Simultaneously, ProductMaster!A:A&ProductMaster!B:B&ProductMaster!C:C&ProductMaster!D:D creates an array of similar concatenated strings for every row in the dataset. XLOOKUP then searches that array for an exact match against your lookup string.

This is elegant, but it has a critical weakness: concatenation can create false matches. Consider these two rows:

ProductCode Region RepID
PRD-44 71Northwest SR-009
PRD-4471 Northwest SR-009

When concatenated, both produce "PRD-4471NorthwestSR-009". Your lookup would incorrectly match the first row if it appears first in the dataset.

Warning

Always use a delimiter character between concatenated fields to prevent false key collisions. Choose a delimiter that will never appear in any of your data fields — a pipe | or tilde ~ works well. Change the formula to: A2&"|"&B2&"|"&C2&"|"&D2 and match it with the same delimiter in the lookup array.

Here's the collision-proof version:

=XLOOKUP(A2&"|"&B2&"|"&C2&"|"&D2, 
         ProductMaster!A:A&"|"&ProductMaster!B:B&"|"&ProductMaster!C:C&"|"&ProductMaster!D:D, 
         ProductMaster!E:E, 
         "No match found")

Returning Multiple Columns at Once

One of XLOOKUP's architectural advantages over VLOOKUP is the ability to return multiple columns in a single formula. Instead of specifying a single column for return_array, you specify a multi-column range:

=XLOOKUP(A2&"|"&B2&"|"&C2&"|"&D2, 
         ProductMaster!A:A&"|"&ProductMaster!B:B&"|"&ProductMaster!C:C&"|"&ProductMaster!D:D, 
         ProductMaster!E:G, 
         "No match")

This single formula returns Revenue, Units, and Status simultaneously — spilling into E, F, and G of your current row. This is XLOOKUP leveraging Excel's dynamic array engine, the same engine that powers the functions covered in Dynamic Arrays: FILTER, SORT, and UNIQUE Explained.

Note

When using multi-column return arrays, the if_not_found value will propagate across all returned columns. A text string like "No match" will cause a TYPE mismatch if downstream formulas expect numbers. Consider returning NA() or an empty string "" instead, depending on your use case.

The Performance Reality of Full-Column References

Using ProductMaster!A:A references entire columns — all 1,048,576 rows. For a multi-criteria lookup where you're concatenating four columns on-the-fly, Excel must build and search a temporary array of over a million concatenated strings. On large datasets, this can be noticeably slow.

The professional approach is to anchor your ranges to your actual data boundaries. If your data runs to row 50,001 (including a header):

=XLOOKUP(A2&"|"&B2&"|"&C2&"|"&D2, 
         ProductMaster!A2:A50001&"|"&ProductMaster!B2:B50001&"|"&ProductMaster!C2:C50001&"|"&ProductMaster!D2:D50001, 
         ProductMaster!E2:G50001, 
         "No match")

Better yet, convert your source data to an Excel Table (covered in depth in Advanced Excel Tables: Sorting, Filtering, and Structured Data Architecture for Data Professionals) and use structured references, which automatically adjust as data grows:

=XLOOKUP(A2&"|"&B2&"|"&C2&"|"&D2,
         ProductMaster[ProductCode]&"|"&ProductMaster[Region]&"|"&ProductMaster[RepID]&"|"&ProductMaster[Quarter],
         ProductMaster[[Revenue]:[Status]],
         "No match")

This is the production-ready version. Structured references are self-documenting, auto-expanding, and significantly easier to audit six months from now.


Wildcard Matching in XLOOKUP: Patterns and Pitfalls

Wildcard matching unlocks a whole class of fuzzy lookup problems. XLOOKUP supports wildcards when you set match_mode to 2:

  • * matches any sequence of characters (including zero characters)
  • ? matches any single character
  • ~ is the escape character (use ~* to search for a literal asterisk)

Basic Wildcard Lookups

Suppose your product codes have inconsistent formatting. Some are stored as "PRD-4471", others as "PRD4471" (no hyphen), others as "4471". You want to find any product code that contains "4471" anywhere in the string:

=XLOOKUP("*4471*", ProductMaster[ProductCode], ProductMaster[Revenue], "Not found", 2)

The *4471* pattern matches any string containing "4471". This is equivalent to a "contains" search.

Other common wildcard patterns:

  • "PRD-????" — matches exactly "PRD-" followed by any four characters
  • "SR-0*" — matches any string starting with "SR-0"
  • "*-2024" — matches any string ending with "-2024"

Wildcard Matching with Dynamic Lookup Values

In practice, you rarely hardcode a wildcard pattern. You build it dynamically from a cell reference:

=XLOOKUP("*"&A2&"*", ProductMaster[ProductCode], ProductMaster[Revenue], "Not found", 2)

Here, if A2 contains "4471", the lookup value becomes "*4471*" at runtime.

Warning

Wildcard matching with match_mode = 2 is an exact match search in the wildcard sense — it returns the first row where the pattern matches, not all matches. If you need all matching rows, XLOOKUP isn't the right tool; use Dynamic Arrays: FILTER, SORT, and UNIQUE Explained with a SEARCH or FIND function instead.

Combining Wildcards with Multi-Criteria

This is where things get genuinely tricky. You can use wildcards in multi-criteria XLOOKUP, but only if all your criteria use the wildcard-compatible concatenation approach:

=XLOOKUP("*4471*"&"|"&"Northwest"&"|"&"*", 
         ProductMaster[ProductCode]&"|"&ProductMaster[Region]&"|"&ProductMaster[RepID],
         ProductMaster[Revenue],
         "Not found",
         2)

This matches any product code containing "4471", in the "Northwest" region, with any rep ID. The * wildcard in the RepID position means "any value" — an effective way to make individual criteria optional.

The Wildcard Escape Problem

If any of your data values legitimately contain * or ? characters — and in financial data, they sometimes do — those characters will be interpreted as wildcards in your lookup, causing unexpected matches. The escape sequence is ~* for a literal asterisk and ~? for a literal question mark.

When building dynamic patterns from cell values, you should sanitize the input:

=XLOOKUP("*"&SUBSTITUTE(SUBSTITUTE(A2,"*","~*"),"?","~?")&"*",
         ProductMaster[ProductCode],
         ProductMaster[Revenue],
         "Not found",
         2)

This replaces any * in A2 with ~* and any ? with ~? before wrapping in wildcard asterisks. It's defensive programming for production lookup formulas.


Approximate Match Modes: When Exact Match Isn't Enough

Beyond exact and wildcard matching, XLOOKUP offers two approximate match modes that are essential for range-based lookups.

Next Smaller Value (`match_mode = -1`)

This is the equivalent of the classic VLOOKUP approximate match used for tax brackets, commission tiers, discount schedules, and similar range lookups. Suppose you have a commission tier table:

Revenue Threshold Commission Rate
0 5%
10,000 7%
25,000 9%
50,000 12%
100,000 15%

The table must be sorted in ascending order. To find the commission rate for $37,500:

=XLOOKUP(37500, TierTable[Revenue Threshold], TierTable[Commission Rate], "Error", -1)

XLOOKUP finds 25,000 as the largest value ≤ 37,500 and returns 9%. This is the "next smaller" match: if there's no exact match, fall back to the next value below.

Key insight

Unlike VLOOKUP's approximate match, XLOOKUP with match_mode = -1 does NOT require your data to be sorted for correctness — it will find the right answer on unsorted data. However, using search_mode = 2 (binary search) alongside it does require sorted data. Separating the concepts of match mode and search mode is critical to avoiding silent errors.

Next Larger Value (`match_mode = 1`)

The mirror of the above — returns the next value above the lookup value when no exact match exists. Useful for "minimum quantity" pricing tables where you want to find the smallest tier that accommodates your order size.

Performance: When to Use Binary Search

Binary search (search_mode = 2 or -2) is an O(log n) algorithm versus the default linear scan's O(n). On a dataset with 100,000 rows, that's roughly the difference between 17 comparisons and 100,000 comparisons.

The trade-off: binary search requires sorted data and will silently return wrong answers on unsorted data. Use it only when you control the data source and can guarantee sort order — ideally enforced by a Table with a sort applied and protected from user modification.

=XLOOKUP(37500, TierTable[Revenue Threshold], TierTable[Commission Rate], "Error", -1, 2)

This is the high-performance version for large, sorted tier tables: match_mode = -1 (next smaller), search_mode = 2 (binary search ascending).


Professional Error Handling Strategies

The if_not_found argument is XLOOKUP's built-in error handler, but professional-grade error handling goes deeper. Let's look at a full taxonomy of errors and strategies.

Understanding the Error Landscape

XLOOKUP can generate or propagate several error types:

  • #N/A — No match found when if_not_found is not specified
  • #VALUE! — lookup_array and return_array are different sizes; or concatenation attempted on incompatible types
  • #REF! — A referenced range has been deleted or is invalid
  • #SPILL! — A multi-column return conflicts with non-empty cells in the spill range
  • #CALC! — The formula returns an empty array (possible in nested XLOOKUP scenarios)

The `if_not_found` Argument vs. IFERROR

There's an important difference between these two approaches:

=IFERROR(XLOOKUP(A2, ProductMaster[ProductCode], ProductMaster[Revenue]), "Not found")

versus:

=XLOOKUP(A2, ProductMaster[ProductCode], ProductMaster[Revenue], "Not found")

Both suppress #N/A when there's no match. But IFERROR suppresses all errors — including #VALUE! and #REF! errors that indicate genuine formula problems you should know about. The if_not_found argument is more surgical: it only handles the no-match case, leaving other errors visible.

For production workbooks, using the if_not_found argument is almost always the better choice. Reserve IFERROR for cases where you deliberately want to catch multiple error types. You can learn much more about the nuances of error handling in Master Error Handling in Excel: IFERROR, IFNA & Professional Debugging Techniques.

Contextual Error Messages

Instead of a generic "Not found", provide context that helps a user understand why the lookup failed:

=XLOOKUP(A2&"|"&B2&"|"&C2,
         ProductMaster[ProductCode]&"|"&ProductMaster[Region]&"|"&ProductMaster[Quarter],
         ProductMaster[Revenue],
         "No data for: "&A2&" / "&B2&" / "&C2)

Now instead of "Not found", users see "No data for: PRD-4471 / Northwest / Q3-2024" — immediately actionable diagnostic information.

Cascading Fallback Lookups

A powerful pattern is nesting XLOOKUP inside another XLOOKUP's if_not_found argument. This creates a lookup waterfall: try the most specific match first, fall back to a less specific match if it fails, then fall back again.

Scenario: You want to find a price override for a specific customer-product combination. If none exists, fall back to a product-level price. If that doesn't exist, fall back to a default category price.

=XLOOKUP(A2&"|"&B2,                              
         PriceOverrides[CustomerID]&"|"&PriceOverrides[ProductCode],
         PriceOverrides[Price],
         XLOOKUP(B2,                              
                 ProductPrices[ProductCode],
                 ProductPrices[StandardPrice],
                 XLOOKUP(C2,                      
                         CategoryPrices[Category],
                         CategoryPrices[DefaultPrice],
                         "No price configured")))

This evaluates as:

  1. Try to find a customer-specific price override
  2. If not found, look up the standard product price
  3. If not found, look up the category default price
  4. If still not found, return "No price configured"

This pattern is cleaner, more readable, and more performant than a deeply nested IF(ISNA(...)) construction.

Tip

The cascading XLOOKUP pattern is an excellent replacement for complex pricing logic that would otherwise require helper columns or VBA. It keeps the logic in a single cell and makes the fallback hierarchy explicit and auditable.

Using IFNA Instead of IFERROR for Lookup Formulas

When you do want to wrap XLOOKUP in an error handler (for example, when handling errors from nested calculations that use the returned value), prefer IFNA over IFERROR. IFNA only catches #N/A errors, leaving other error types visible:

=IFNA(XLOOKUP(A2, ProductMaster[ProductCode], ProductMaster[Revenue]) * TaxRate, 
      0)

Here, if the XLOOKUP returns #N/A (no match), the multiplication would also produce #N/A, and IFNA catches it. But a #VALUE! or #REF! from a broken reference would still surface.


Advanced Patterns: Nested, Chained, and Bidirectional Lookups

Bidirectional (Two-Dimensional) Lookup

One of the most requested lookup patterns is the two-dimensional lookup: find a value at the intersection of a row and a column. Classic approaches involved INDEX-MATCH-MATCH or VLOOKUP-MATCH. XLOOKUP's elegant solution:

Suppose you have a pivot-style table where rows are product codes and columns are quarters, and you want to find the revenue for a specific product in a specific quarter.

=XLOOKUP(A2,                              
         PivotTable[Product],             
         XLOOKUP(B2,                      
                 PivotHeaders,            
                 PivotTable))             

The inner XLOOKUP finds the column matching your quarter value (B2) within the header row PivotHeaders. It returns the entire column of data. The outer XLOOKUP then searches the product column for your product code and returns the value from the column the inner XLOOKUP selected.

This is genuinely elegant — two XLOOKUPs composing into a 2D lookup with no array magic required.

Returning the Last Match with `search_mode = -1`

The default XLOOKUP returns the first match. In many real-world scenarios — latest transaction, most recent price change, current record — you want the last match. Simply flip the search direction:

=XLOOKUP(A2, 
         ProductMaster[ProductCode], 
         ProductMaster[Revenue],
         "Not found",
         0,
         -1)

search_mode = -1 searches from the last row upward, so the first match it finds is the last one in the dataset. This is far cleaner than the old approach of sorting descending and hoping for the best.

Horizontal XLOOKUP

XLOOKUP works on rows just as well as columns — you don't need HLOOKUP anymore. If your lookup array and return array are horizontal ranges:

=XLOOKUP("Q3-2024", 
         QuarterHeaders,    
         RevenueRow)        

Where QuarterHeaders is a single row (e.g., B1:G1) and RevenueRow is a single row of values (e.g., B5:G5). XLOOKUP recognizes the orientation automatically.

Chained XLOOKUP for Hierarchical Data

Suppose you have a two-table structure: a Regions table that maps region codes to account managers, and an AccountManagers table that maps manager names to their targets. You want to find the target for a given region — without a helper column.

=XLOOKUP(
    XLOOKUP(A2, Regions[RegionCode], Regions[ManagerName], "Unknown"),
    AccountManagers[ManagerName],
    AccountManagers[AnnualTarget],
    "Target not set"
)

The inner XLOOKUP resolves the region code to a manager name. The outer XLOOKUP then looks up that manager name in the AccountManagers table. Chain as many levels as your data model requires — though beyond three levels, you should question whether the data structure itself needs redesign.

Note

Chained XLOOKUP formulas can be harder to debug than they look. Use Excel's Evaluate Formula tool to step through each level. You can learn this technique in detail in Mastering Excel Formula Auditing: Trace Precedents, Dependents, and Evaluate Formulas to Build Error-Free Workbooks.


XLOOKUP vs. the Alternatives: Making Deliberate Architectural Choices

With all these capabilities, when should you not use XLOOKUP?

XLOOKUP vs. SUMIFS for Multi-Criteria Aggregation

XLOOKUP finds the first (or last) match. If your dataset has multiple rows matching your criteria and you want the sum of all matching values, XLOOKUP is the wrong tool. Use SUMIFS:

=SUMIFS(ProductMaster[Revenue], 
        ProductMaster[ProductCode], A2,
        ProductMaster[Region], B2,
        ProductMaster[Quarter], C2)

SUMIFS with multiple criteria is specifically designed for this and performs extremely well. For a deep dive on this family of functions, see Master SUMIFS, COUNTIFS, and AVERAGEIFS: Multi-Criteria Calculations in Excel.

The rule of thumb: if your dataset is structured (one row per unique combination of criteria), use XLOOKUP. If multiple rows can match and you need an aggregate, use SUMIFS/COUNTIFS/AVERAGEIFS.

XLOOKUP vs. INDEX-MATCH

For users on Excel 2019 or earlier, INDEX-MATCH remains the best lookup pattern. But even on Microsoft 365, there are cases where INDEX-MATCH has an edge:

  • XLOOKUP advantage: Cleaner syntax, built-in error handling, native last-match support, bidirectional capability without MATCH nesting
  • INDEX-MATCH advantage: Available in older Excel versions, slightly more flexible when you need the row number for secondary calculations, works inside SUMPRODUCT for array-based multi-criteria

If you're maintaining workbooks that must work across Excel versions, INDEX-MATCH is the safer choice for lookup logic.

XLOOKUP vs. FILTER for Multiple-Row Returns

XLOOKUP returns one row of results. FILTER returns all matching rows. If your question is "give me every transaction for this customer," FILTER is what you want — XLOOKUP will silently give you only the first one.

=FILTER(ProductMaster, ProductMaster[ProductCode]=A2, "No matches")

Use XLOOKUP when you want one result; use FILTER when you want all results.


Performance Optimization for Large Datasets

At enterprise scale, lookup formula performance matters. Here's a practical performance framework:

Benchmark the Baseline

Before optimizing, understand your current performance. Open the Name Manager and check whether your formulas are in volatile or non-volatile functions. XLOOKUP itself is non-volatile — it doesn't recalculate unless its inputs change. That's a significant advantage over OFFSET-based lookups.

Limit Range Size

As discussed earlier, avoid full-column references in multi-criteria concatenation. Every extra row in the lookup array is extra computation. Use exact ranges or structured table references.

Use Binary Search Where Appropriate

If your lookup column is sorted and you're running thousands of XLOOKUPs, switching to search_mode = 2 can be transformative. Binary search on 100,000 rows is ~99.98% fewer comparisons than linear search.

Consider Helper Columns for Complex Criteria

Counter-intuitive advice: sometimes the right answer is to pre-compute your concatenated key in a helper column rather than concatenating on-the-fly in every XLOOKUP. If you have 10,000 formulas all concatenating the same four columns from the same source table, computing the key once per source row (in the table itself) and then doing a simple single-column XLOOKUP against that helper column will be faster overall.

=[@ProductCode]&"|"&[@Region]&"|"&[@RepID]&"|"&[@Quarter]

Add this as a calculated column [LookupKey] in your source table, then:

=XLOOKUP(A2&"|"&B2&"|"&C2&"|"&D2, ProductMaster[LookupKey], ProductMaster[Revenue], "Not found")

This trades one extra column of storage for significantly faster lookups when the formula is used many times.

Manual Calculation Mode for Batch Entry

When building or editing a workbook with thousands of complex XLOOKUP formulas, working in automatic calculation mode means every keystroke triggers a recalculation wave. Switch to manual calculation (Formulas tab → Calculation Options → Manual) during bulk edits, then recalculate with F9 when ready.

Warning

Never save a workbook in manual calculation mode without documenting this clearly for other users. A colleague opening the file and seeing stale values without understanding why can cause serious data errors. Add a bright conditional formatting indicator on the sheet showing calculation mode status, or switch back to automatic before saving.


Hands-On Exercise

Work through this exercise to cement everything covered in the lesson. Build it from scratch in a new workbook.

Dataset Setup

Create a sheet called SalesData with these columns and at least 20 rows of sample data:

Column Header Sample Values
A ProductCode PRD-001, PRD-002, PRD-004, etc.
B Region North, South, East, West
C RepID SR-001 through SR-005
D Quarter Q1-2024, Q2-2024, Q3-2024, Q4-2024
E Revenue Various numbers from 5000 to 150000
F Units Various integers
G Status Active, Discontinued, Pending

Include at least one product code with a slight variation (e.g., "PRD004" without the hyphen) for the wildcard exercise. Include two rows with the same ProductCode in different regions to test multi-criteria behavior.

Convert this range to an Excel Table named SalesData.

Exercise Tasks

Task 1: Basic Multi-Criteria Lookup

On a new sheet called Lookup, create input cells:

  • B1: Product Code (type a code that exists in your table)
  • B2: Region
  • B3: Rep ID
  • B4: Quarter

In B6, write an XLOOKUP formula that finds the Revenue for the exact combination of all four criteria. Use delimiter-separated concatenation. Display "No match for these criteria" if not found.

Task 2: Multi-Column Return

In B8, write a single XLOOKUP formula that returns Revenue, Units, and Status for the same criteria combination, spilling across three cells (B8:D8). Add column headers in B7:D7.

Task 3: Wildcard Lookup

Create an input cell B11 for a partial product code search term. In B12, write an XLOOKUP that finds the first Revenue value for any ProductCode containing the search term (use match_mode = 2). Test it with "004" as the search term — it should match "PRD-004".

Task 4: Cascading Fallback

Create a small PricingDefaults table on a new sheet with two columns: Category (General) and DefaultRevenue (50000). Write a formula on the Lookup sheet that:

  1. First looks for an exact match in SalesData using the ProductCode from B1
  2. If not found, looks up the "General" default in PricingDefaults
  3. If still not found, displays "No pricing data available"

Task 5: Last-Match Lookup

In your SalesData table, ensure at least two rows share the same ProductCode. In B14 on the Lookup sheet, write an XLOOKUP that returns the Revenue from the last row matching the ProductCode in B1 (use search_mode = -1). Verify it differs from a forward-search result.

Task 6: Wildcard Escape Edge Case

Add a row to SalesData where the ProductCode contains an asterisk: "PRD*999". In B16, write an XLOOKUP that searches for this exact product code (not a wildcard pattern), using proper escape handling in the SUBSTITUTE function.


Common Mistakes & Troubleshooting

Mistake 1: Forgetting Delimiters in Concatenated Keys

Symptom: Formula returns a match that seems wrong — the values don't correspond to the criteria you entered.

Diagnosis: You have a key collision. Two different combinations of criteria produce the same concatenated string.

Fix: Add pipe or tilde delimiters between all concatenated fields in both the lookup value and lookup array.

Mistake 2: Mismatched Lookup and Return Array Sizes

Symptom: #VALUE! error.

Diagnosis: Your lookup_array and return_array have different numbers of rows (or columns for horizontal lookups).

Fix: Verify both arrays span exactly the same rows. If using structured references, ensure your table column references all point to the same table and haven't been accidentally offset.

Mistake 3: Using `match_mode = 2` (Wildcard) Without Intending To

Symptom: Your formula returns a seemingly random match when you expect an exact match, or returns #N/A when the value definitely exists but contains special characters.

Diagnosis: You've set match_mode = 2 but your lookup values contain literal * or ? characters that are being interpreted as wildcards.

Fix: Either switch to match_mode = 0 for exact matching, or implement the SUBSTITUTE escape pattern shown earlier.

Mistake 4: Binary Search on Unsorted Data

Symptom: Formula returns a result, but the result is wrong — it's a value that shouldn't match your lookup.

Diagnosis: You've used search_mode = 2 (binary search) but the lookup array isn't actually sorted.

Fix: Remove search_mode = 2 (fall back to linear search) or sort the source data. Binary search silent failures are among the hardest lookup bugs to catch because the formula happily returns a plausible-looking value.

Mistake 5: SPILL Errors in Multi-Column Returns

Symptom: #SPILL! error when your XLOOKUP should return multiple columns.

Diagnosis: There's a non-empty cell in the range where the formula is trying to spill its results.

Fix: Clear the cells in the expected spill range. Select the formula cell and check the blue border that appears — it shows where Excel is trying to spill. Any non-empty cell within that border blocks the spill.

Mistake 6: Case-Sensitive Matching

Symptom: Formula fails to find "northwest" when the data contains "Northwest" — or you need case-sensitive matching and XLOOKUP is case-insensitive.

Diagnosis: XLOOKUP is inherently case-insensitive. "NORTHWEST", "Northwest", and "northwest" all match the same records.

Fix: For the rare case where you need case-sensitive lookup, use a helper formula approach: combine EXACT with MATCH to find the row, then use INDEX to retrieve the value. XLOOKUP cannot do case-sensitive matching natively.

Mistake 7: `if_not_found` Returns the Wrong Data Type

Symptom: A formula that uses the XLOOKUP result in arithmetic returns #VALUE! even when the lookup succeeds — or shows errors in cells where "Not found" is returned.

Diagnosis: Your if_not_found value is a text string, but downstream formulas expect a number (or vice versa).

Fix: Return 0 instead of "Not found" when downstream arithmetic must continue; or use a conditional check on the result before performing calculations. An empty string "" is another option that's neutral in many formula contexts.


Summary & Next Steps

You've now covered XLOOKUP at a depth that most Excel professionals — including many who've used it for years — never reach. Let's consolidate the key architectural principles:

Multi-criteria lookups use concatenation with delimiters to build synthetic composite keys. Always use a delimiter character that can't appear in your data to prevent key collisions. Return multiple columns from a single formula using a multi-column return_array.

Wildcard matching (match_mode = 2) enables fuzzy lookup patterns but only returns the first match and is vulnerable to literal * and ? characters in your data. Sanitize inputs with SUBSTITUTE when building wildcard patterns dynamically.

Approximate match modes (-1 and 1) handle range-based lookups like tier tables and bracket pricing. Understand the independence of match_mode and search_mode — binary search requires sorted data and will silently return wrong results otherwise.

Professional error handling uses the built-in if_not_found argument over IFERROR for surgical error suppression, builds contextual error messages for user-facing workbooks, and implements cascading fallback lookups for hierarchical data resolution.

Performance is managed through bounded range references, structured table references, strategic use of binary search, and pre-computed helper columns when the same lookup array is used across thousands of formulas.

Architectural judgment means knowing when XLOOKUP is the wrong tool: use SUMIFS when you need aggregates across multiple matching rows, FILTER when you need all matching rows, and INDEX-MATCH when you need cross-version compatibility.

Where to Go Next

With lookup mastery established, the natural next steps are building it into something visible and interactive. Consider exploring Building Dynamic Charts and Dashboards in Excel: Interactive Data Visualization Mastery to turn your lookup-powered data into executive-ready dashboards. If your data arrives messy from external sources — with inconsistent codes, mixed case, or extra spaces that break your lookups — Importing and Cleaning External Data in Excel: Text to Columns, Flash Fill, and Data Transformation Techniques is essential reading.

For truly complex multi-condition analysis where you need weighted calculations across multiple criteria simultaneously, Mastering Excel's SUMPRODUCT Function: Multi-Condition Calculations and Weighted Analysis Without Helper Columns rounds out your toolkit beautifully — SUMPRODUCT and XLOOKUP together handle virtually any business question you can throw at Excel.

You now have not just a function in your toolkit, but a lookup philosophy: understand the data structure, choose the right matching strategy, handle errors deliberately, and optimize for the scale at which your workbook actually operates.

Work With Us

From insight to implementation

Reading is the start. When you're ready to build the data, automation, or AI systems behind it, our team turns strategy into shipped results.

Let's Build

Excel Fundamentals

Previous

Mastering Excel's Workbook and Cell Protection: Lock Ranges, Hide Formulas, and Control Edit Access for Shared Spreadsheets

Next

Workbook and Worksheet Basics: Creating, Saving, and Organizing Excel Files for Data Professionals

Related Insights

Microsoft ExcelPractitioner

Mastering Excel's Chart Object Model in VBA: Programmatically Create, Modify, and Export Embedded Charts and ChartSheets for Automated Report Generation

21 min
Microsoft ExcelPractitioner

Mastering Excel's Find & Replace, Go To Special, and Name Box for Fast Worksheet Navigation and Bulk Editing

23 min
Microsoft ExcelFoundation

VBA FileSystemObject Fundamentals: Read, Write, and Manage Files and Folders Directly from Excel

16 min

On this page

  • Introduction
  • Prerequisites
  • Understanding XLOOKUP's Full Syntax
  • Single-Criteria XLOOKUP: The Baseline You're Already Past
  • Multi-Criteria XLOOKUP: Array Concatenation Explained
  • How Concatenation Creates a Synthetic Key
  • Returning Multiple Columns at Once
  • The Performance Reality of Full-Column References
  • Wildcard Matching in XLOOKUP: Patterns and Pitfalls
  • Basic Wildcard Lookups
  • Wildcard Matching with Dynamic Lookup Values
  • Combining Wildcards with Multi-Criteria
  • The Wildcard Escape Problem
  • Approximate Match Modes: When Exact Match Isn't Enough
  • Next Smaller Value (`match_mode = -1`)
  • Next Larger Value (`match_mode = 1`)
  • Performance: When to Use Binary Search
  • Professional Error Handling Strategies
  • Understanding the Error Landscape
  • The `if_not_found` Argument vs. IFERROR
  • Contextual Error Messages
  • Cascading Fallback Lookups
  • Using IFNA Instead of IFERROR for Lookup Formulas
  • Advanced Patterns: Nested, Chained, and Bidirectional Lookups
  • Bidirectional (Two-Dimensional) Lookup
  • Returning the Last Match with `search_mode = -1`
  • Horizontal XLOOKUP
  • Chained XLOOKUP for Hierarchical Data
  • XLOOKUP vs. the Alternatives: Making Deliberate Architectural Choices
  • XLOOKUP vs. SUMIFS for Multi-Criteria Aggregation
  • XLOOKUP vs. INDEX-MATCH
  • XLOOKUP vs. FILTER for Multiple-Row Returns
  • Performance Optimization for Large Datasets
  • Benchmark the Baseline
  • Limit Range Size
  • Use Binary Search Where Appropriate
  • Consider Helper Columns for Complex Criteria
  • Manual Calculation Mode for Batch Entry
  • Hands-On Exercise
  • Dataset Setup
  • Exercise Tasks
  • Common Mistakes & Troubleshooting
  • Mistake 1: Forgetting Delimiters in Concatenated Keys
  • Mistake 2: Mismatched Lookup and Return Array Sizes
  • Mistake 3: Using `match_mode = 2` (Wildcard) Without Intending To
  • Mistake 4: Binary Search on Unsorted Data
  • Mistake 5: SPILL Errors in Multi-Column Returns
  • Mistake 6: Case-Sensitive Matching
  • Mistake 7: `if_not_found` Returns the Wrong Data Type
  • Summary & Next Steps
  • Where to Go Next