FormulaCamp
Completed
← All functions
Lookup & reference

XLOOKUP

Modern lookup in any direction.

Syntax

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

Example: =XLOOKUP(A2,B:B,C:C,"none")

Available in: Excel 2021+, Microsoft 365

XLOOKUP searches one range for a value and returns the matching item from another range, in any direction. It defaults to an exact match, can look left, and lets you set a custom message when nothing is found, so it replaces most VLOOKUP and INDEX/MATCH formulas in Microsoft 365 and Excel 2021 or later.

When to use it

Arguments explained

Worked examples

Look up a price by SKU

ABCDEF
1SKUProductPriceLook upPrice
2A101Desk lamp24.99A103
3A102Monitor stand39
4A103USB hub18.5

Formula: F2: =XLOOKUP(E2,A2:A4,C2:C4)

Result: 18.5

Searches A2:A4 and returns the item in the same position of C2:C4. Exact match is the default.

Custom message when missing

ABCDE
1SKUPriceLook upPrice
2A10124.99Z999
3A10239

Formula: E2: =XLOOKUP(D2,A2:A3,B2:B3,"Not in catalog")

Result: Not in catalog

The fourth argument replaces #N/A with your own text.

Look left of the key

AB
1EmployeeID
2Maria Lopez1042
3James Cole1043
4Priya Shah1044

Formula: D2: =XLOOKUP(1043,B2:B4,A2:A4)

Result: James Cole

The return range (names) sits left of the search range (IDs). VLOOKUP cannot do this.

Try it

A tiny spreadsheet with example data. Edit the formula or any number and see the result.

Formula in F2: =XLOOKUP(103,A2:A6,B2:B6,"none")

Example spreadsheet for XLOOKUP
ABCDEF
1IDItemPriceStockResult
2101Pen2.5120Lamp
3102Notebook480
4103Lamp2515
5104Mug7.540
6105Backpack3912
Result in F2: Lamp
Practice this in a lesson: XLOOKUP

Common errors and how to fix them

Related functions

Frequently asked questions

Is XLOOKUP better than VLOOKUP?
For most jobs, yes: it is exact by default, looks in any direction, does not break when columns are inserted and has a built-in not-found message. VLOOKUP still matters for compatibility with older Excel.
Can XLOOKUP return several columns?
Yes. Give a multi-column return range such as B2:D10 and the result spills across the columns.
Does XLOOKUP work in Excel 2019?
No. It is available in Excel 2021, Excel 2024 and Microsoft 365.
How do I do an approximate match with XLOOKUP?
Set the fifth argument match_mode to -1 (exact or next smaller) or 1 (exact or next larger). No sorting is required.

Practice

More in Lookup & reference