The guide · XLOOKUP
Syntax
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
- lookup_value: what to look for.
- lookup_array: the column to search in.
- return_array: the column to return from. It can be anywhere, left or right.
- if_not_found: what to show instead of #N/A.
- match_mode: 0 exact (the default), -1 exact or next smaller, 1 exact or next larger, 2 wildcards.
- search_mode: 1 searches from the top (the default), -1 from the bottom.
Why it's easier than VLOOKUP
- It looks left. VLOOKUP can only return columns to the right of the one it searches.
- No column number to count, so inserting a column doesn't break it.
- Exact match by default, so there's no FALSE to forget.
- A built-in message for missing values, without wrapping it in IFERROR.
XLOOKUP is in Excel for Microsoft 365, Excel 2021 and later, and Excel for the web. Older versions show #NAME?, so for files shared with them use VLOOKUP or INDEX and MATCH.
The two ranges must line up
XLOOKUP finds the position of the match in the lookup range and returns the item at the same position in the return range. If one range starts on row 2 and the other on row 1, every answer comes from the row above: no error, just wrong numbers. Make both ranges start and end on the same rows.
Common mistakes
- Ranges that don't line up, like
B2:B7withA1:A6. Each answer belongs to a neighbor. - Ranges of different sizes, which give #VALUE!.
- Forgetting $ before filling down. The ranges slide and the top rows drop out.
- Leaving out if_not_found when some values are expected to be missing. A wall of #N/A hides the rows that matter.
FAQ
- What is the difference between XLOOKUP and VLOOKUP?
- XLOOKUP takes a lookup column and a return column instead of a table and a column number. It can return values to the left, matches exactly by default and has a built-in if_not_found argument.
- Which versions of Excel have XLOOKUP?
- Excel for Microsoft 365, Excel 2021 and later, and Excel for the web. Excel 2019 and older do not have it.
- How do I stop XLOOKUP returning #N/A?
- Give it a 4th argument: =XLOOKUP(E2,B2:B7,A2:A7,"Not found") shows Not found when there is no match.
- Can XLOOKUP look to the left?
- Yes. The return range can be any column, including one to the left of the column you search.