XLOOKUP Function
XLOOKUP is the upgraded VLOOKUP — it can search left or right, doesn't require a column index number, handles missing values with a default result, and supports nested arrays. Available in Excel 365 and Excel 2021+.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| lookup_value | The value you want to find. | Required |
| lookup_array | The range or array to search through. | Required |
| return_array | The range or array to return values from. | Required |
| if_not_found | What to return if no match is found (instead of #N/A). | Optional |
| match_mode | 0 = exact match, -1 = exact or next smaller, 1 = exact or next larger, 2 = wildcard. | Optional |
| search_mode | 1 = first-to-last, -1 = last-to-first, 2 = binary search (ascending), -2 = binary search (descending). | Optional |
Basic Example
Find a product price by looking up the product ID
=XLOOKUP("A102", B2:B50, E2:E50)This searches for "A102" in B2:B50 and returns the corresponding value from E2:E50. No column number needed — just the return range.
Advanced Examples
Example 1: XLOOKUP with default value for missing items
Data validationReturn 'Not found' instead of #N/A when the lookup value doesn't exist
=XLOOKUP(E2, A2:A100, D2:D100, "Not found")Example 2: XLOOKUP searching left (reverse lookup)
Flexible lookupFind an employee's ID by looking up their name — searching left, which VLOOKUP cannot do
=XLOOKUP("John Smith", C2:C100, A2:A100)Example 3: XLOOKUP returning multiple columns
Data extractionReturn an entire row of data (multiple columns) with a single XLOOKUP
=XLOOKUP(E2, A2:A100, B2:D100)How XLOOKUP Works
XLOOKUP fundamentally improves on VLOOKUP in three ways. First, it separates the lookup array and return array — you specify exactly which column to search and which to return, so it can look left or right. Second, it has a built-in 'if_not_found' argument that handles missing values without wrapping in IFERROR. Third, it supports advanced match modes including wildcard matching and binary search for large datasets. Unlike VLOOKUP, XLOOKUP doesn't break when you insert or delete columns because it uses range references instead of a column index number.
Important Notes & Limitations
XLOOKUP is only available in Excel 365 and Excel 2021+ — not in Excel 2019 or earlier versions.
Google Sheets does not have XLOOKUP (use FILTER, INDEX/MATCH, or VLOOKUP as alternatives).
For very large datasets (100K+ rows), binary search mode (search_mode=2/-2) requires sorted data.
When return_array spans multiple columns, results spill into adjacent cells — those cells must be empty.
Common Errors & Fixes
#VALUE!lookup_array and return_array have different sizes (different number of rows or columns)Fix: Ensure both arrays have the same length. For example, if lookup_array is A2:A100, return_array should also span 99 rows.
#N/A (if no if_not_found set)The lookup value doesn't exist in the lookup_arrayFix: Add a 4th argument to provide a default value: =XLOOKUP(val, range, result_range, "Not found")
#SPILL!Return array spans multiple columns and adjacent cells aren't emptyFix: Clear the cells where XLOOKUP needs to spill results, or use a single-column return array.
Download Practice File
XLOOKUP
xlookupPractice XLOOKUP with Real Data
Download a sample CSV file with pre-populated data and practice exercises for the XLOOKUP function. Works in both Excel and Google Sheets.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps
Related Tutorials
INDEX MATCH Formula
Master the INDEX MATCH formula in Excel and Google Sheets step by step: exact syntax, left lookups, two-way lookups, and how it compares to VLOOKUP and XLOOKUP.
Nested If Alternatives
Long nested IF formulas are hard to read and easy to break. Discover the best nested IF alternatives in Excel and Google Sheets — IFS, lookup tables, and XLOOKUP.
VLOOKUP with Multiple Criteria
VLOOKUP only matches one column, but real lookups often need two or more. Learn four reliable ways to do a VLOOKUP with multiple criteria in Excel and Google Sheets.