LocalExcelTool
Get started

Excel XLOOKUP function

XLOOKUP replaces VLOOKUP: the key can be in any column, the result can sit to its left, a missing match can return a value you choose, and the default is an exact match. It takes two ranges of equal height instead of a column number, so inserting or deleting a column never breaks the formula.

Lookup & reference · Available in: Excel 2021 and Excel 365

Syntax

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

What it returns The value at the matched position in return_array — or a whole row/column, which spills.

Arguments
lookup_valuerequiredThe value to find.
lookup_arrayrequiredThe column (or row) to search, usually a full range.
return_arrayrequiredWhat to return, with the same number of rows as lookup_array.
if_not_foundoptionalWhat to return when nothing matches; omitted means #N/A.
match_modeoptional0 exact (default); -1 exact or next smaller; 1 exact or next larger; 2 wildcard.
search_modeoptional1 search first to last (default); -1 last to first; 2/-2 binary search, which requires sorted data.

Examples

Product name by SKU (key left, result right)

SKUProductPrice
A-100Standing desk349
B-220Monitor arm89
C-310Footrest45
= XLOOKUP("B-220",A2:A4,B2:B4)

→ Monitor arm

B-220 is found at the second position of A2:A4, so the second value of B2:B4 is returned. The two ranges must be the same height, but which one sits on the left does not matter.

A readable message when the key is missing

SKUProductPrice
A-100Standing desk349
B-220Monitor arm89
= XLOOKUP("Z-999",A2:A4,C2:C4,"Not in catalogue")

→ Not in catalogue

The fourth argument replaces the old IFERROR wrapper. It only fires on "not found" — real errors, such as #VALUE! from mismatched range heights, still surface. That is the point: a configuration mistake should not look like an empty result.

Common mistakes

  • 1.Thinking a fourth argument is needed for an exact match. XLOOKUP is exact by default — the opposite of VLOOKUP — and adding FALSE only sets match_mode=0, which reads as if it changed something.
  • 2.Ranges of different heights: lookup_array A2:A100 with return_array B2:B99 returns #VALUE!.
  • 3.Passing a whole column (B:B) as return_array. The result is right but every recalculation scans a million rows; B2:B1000 is the practical range.
  • 4.Not available before Excel 2021. Shared with an older machine, the formula shows #NAME?.

How to use it

  1. 1.Click the cell where the result should appear.
  2. 2.Type = then the function name, and press Tab to accept it.
  3. 3.Enter each argument separated by commas; ranges can be dragged with the mouse.
  4. 4.Press Enter. Drag the fill handle down if the same formula applies to more rows.

Frequently asked questions

What is the syntax of XLOOKUP?

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]). What it returns: The value at the matched position in return_array — or a whole row/column, which spills.

Which Excel versions support XLOOKUP?

Excel 2021 and Excel 365. It is available in every desktop version unless the note above says otherwise.

Why does XLOOKUP return an error instead of a value?

Thinking a fourth argument is needed for an exact match. XLOOKUP is exact by default — the opposite of VLOOKUP — and adding FALSE only sets match_mode=0, which reads as if it changed something.

Related functions

More in this group

Need to get the data in first?

← All Excel formulas