fxExcelReps
PRO

You've used your 3 free functions

To practise XLOOKUP and every other function, get a PRO subscription.

  • Unlimited access to every function
  • New functions and exercises every month
  • Every mistake explained + full solutions

Your free functions — you can always come back to these:

← All functions

How to use XLOOKUP in Excel

XLOOKUP is the modern lookup: you give it the column to search and the column to return separately. It looks in any direction, defaults to an exact match, has a built-in "not found" value and doesn't break when you insert columns.

Syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found])

lookup_valueWhat to look for.
lookup_arrayWhere to search — one column or row.
return_arrayWhat to return — same size as lookup_array.
[if_not_found]Value to return when nothing is found (instead of #N/A).
[match_mode]0 exact (default), −1 exact or next smaller, 1 exact or next larger, 2 wildcard.
[search_mode]1 first to last (default), −1 last to first.

Examples

=XLOOKUP(E2, A2:A100, C2:C100)Price for the code in E2.
=XLOOKUP(E2, B2:B100, A2:A100)Lookup to the left — code for a product name.
=XLOOKUP(E2, A2:A100, C2:C100, 0)Return 0 when the code doesn't exist.
=XLOOKUP(E2, A2:A100, B2:D100)Return three columns at once (spills into neighbouring cells).
=XLOOKUP(E2, A2:A100, C2:C100, , 0, -1)Find the last match, e.g. the latest order of a customer.

XLOOKUP vs VLOOKUP, side by side

The same lookup written both ways. XLOOKUP needs no column number and no FALSE: you point at the column to search and the column to return.

=VLOOKUP(E2, A2:C100, 3, FALSE)Classic VLOOKUP: the price from the 3rd column.
=XLOOKUP(E2, A2:A100, C2:C100)The same result with XLOOKUP.
=XLOOKUP(E2, C2:C100, A2:A100)Look to the left: the code for a given price, impossible with VLOOKUP.

A message instead of #N/A

The 4th argument is what to show when nothing is found, so you don't need IFERROR or IFNA around the formula.

=XLOOKUP(E2, A2:A100, C2:C100, "Not in the list")A clear message for a missing code.

Approximate matches and wildcards

The 5th argument, match_mode, sets how XLOOKUP matches: 0 exact (the default), -1 exact or the next smaller value, 1 exact or the next larger value, 2 wildcards (* and ?). Unlike VLOOKUP, the list doesn't have to be sorted for -1 and 1.

=XLOOKUP(B2, G2:G5, H2:H5, , -1)Commission tier: the largest threshold that isn't above B2.
=XLOOKUP("*"&E2&"*", B2:B100, C2:C100, "None", 2)The first product whose name contains the text in E2.

Find the last match

The 6th argument, search_mode, sets the direction. -1 searches from the bottom up, so you get the latest entry, like the last price a customer paid.

=XLOOKUP(E2, A2:A100, C2:C100, , 0, -1)The most recent value for E2 in a list sorted by date.

Common mistakes

#VALUE! error
lookup_array and return_array have different sizes.
#NAME? error
Your Excel is older than 2021 / Microsoft 365. Use INDEX/MATCH instead.
#N/A error
Value not found — check spaces and text vs. numbers, or use the 4th argument.

Frequently asked questions

Which versions of Excel have XLOOKUP?

Microsoft 365, Excel 2021, Excel 2024 and Excel for the web. Excel 2019 and older don't have it and show #NAME?. Google Sheets supports XLOOKUP too.

Is XLOOKUP better than INDEX/MATCH?

For most jobs, yes: one function instead of two, an exact match by default and a built-in "not found" value. INDEX/MATCH is still the safe choice when the file has to work in older versions.

Why does XLOOKUP return #VALUE!?

The lookup array and the return array have different sizes, for example A2:A100 and C2:C99. Make both ranges start and end on the same rows.

Can XLOOKUP return more than one column?

Yes. Give it a return range several columns wide, like B2:D100, and the results spill into the cells to the right. Keep those cells empty or you'll get #SPILL!.

Available in: Excel 2021, Microsoft 365, Excel for the web, Google Sheets

Related functions

VLOOKUPINDEXMATCHIFERROR