Field Guide

XLOOKUP in Excel: how to use it, and why it beats VLOOKUP

Updated

XLOOKUP is Excel’s modern lookup function, and for most new formulas it is the one to reach for instead of VLOOKUP. It searches one column or row for a value and returns the matching value from another, in either direction. It matches exactly by default, and it takes a built-in argument for what to show when there is no match.

The three required parts are the value to find, the array to search, and the array to return: =XLOOKUP(lookup_value, lookup_array, return_array). Everything else is optional. The rest of this guide walks through each argument, shows why XLOOKUP is safer than VLOOKUP, and covers the errors that trip people up.

What is XLOOKUP?

XLOOKUP finds a value in a lookup array and returns the value in the same position from a return array. The full syntax is:

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

The first three arguments are required; the three in brackets are optional. Here it looks up an employee ID and returns that person’s department:

E2
fx
=XLOOKUP(D2, A2:A5, C2:C5)
A B C D E
1 ID Name Dept Find ID Dept
2 E-01 Amir Finance E-03 Ops
3 E-02 Bea Sales
4 E-03 Cai Ops
5 E-04 Dana Finance
XLOOKUP searches A2:A5 for the ID in D2, then returns the matching cell from C2:C5.

If the value isn’t found and you haven’t told it otherwise, XLOOKUP returns #N/A.

How to use XLOOKUP

Read the three required arguments as a sentence: find this, in here, and give me back that.

The lookup and return arrays should be the same length, and they can sit in any order. That last point is the first big difference from VLOOKUP: the column you search can be to the right of the column you return.

fx
=XLOOKUP(D2, C2:C5, A2:A5)

This searches the Dept column (C) and returns the ID (A), to its left. VLOOKUP cannot do that at all, because it only ever looks in the leftmost column of its table.

XLOOKUP vs VLOOKUP: what actually changed

VLOOKUP still works, and on a simple left-to-right lookup the two behave the same. But XLOOKUP removes the traps that make VLOOKUP fragile:

VLOOKUP XLOOKUP
Where it can look leftmost column only any column, either direction
How it returns a value a column number you count by hand a return array you select
Default match approximate (assumes sorted data) exact
No match found returns #N/A (wrap in IFNA) built-in if_not_found argument
Return more than one column no yes, it can return several at once
Works in Excel 2016 / 2019 yes no (Microsoft 365 / 2021+)

Two of those rows matter most in practice. First, XLOOKUP matches exactly by default, while VLOOKUP defaults to an approximate match that quietly returns the wrong row on unsorted data. Second, XLOOKUP returns an array instead of a counted column number: a VLOOKUP written as =VLOOKUP(D2, A2:F5, 4, FALSE) breaks the moment someone inserts a column, because column 4 is now the wrong one. XLOOKUP points at the return column directly, so it moves with it.

The row-by-row trade-offs, including when VLOOKUP is still the right call, get a fuller treatment in VLOOKUP vs XLOOKUP: which should you use?

The optional arguments that make XLOOKUP powerful

if_not_found (4th argument) replaces the need to wrap the whole thing in IFNA. Instead of a bare #N/A, show your own text:

fx
=XLOOKUP(D2, A2:A5, C2:C5, “Not found”)

match_mode (5th argument) controls how it matches. The default is an exact match, which is what you want almost every time.

search_mode (6th argument) controls direction. It defaults to searching top-to-bottom (1). Use -1 to search bottom-to-top, which is how you find the last match rather than the first. Values 2 and -2 run a faster binary search but require the data to be sorted.

Return more than one column by giving return_array several columns. This single formula returns both the name and the department, spilling into two cells:

fx
=XLOOKUP(D2, A2:A5, B2:C5)

XLOOKUP with multiple criteria

Because lookup_array can be an expression rather than a plain range, XLOOKUP can match on more than one column. The most common pattern multiplies the conditions together and looks for the row where they’re all true (a 1):

=XLOOKUP(1, (A2:A5="North")*(B2:B5="Q1"), C2:C5)
Each comparison is a column of TRUE/FALSE. Multiplying them gives 1 only where both are true, and XLOOKUP finds that 1.

If you’d rather not think in arrays, join the keys instead and look up the combined string:

fx
=XLOOKUP(F2&G2, A2:A5&B2:B5, C2:C5)

Both return the value from C2:C5 on the row where the region and the quarter match.

Why is my XLOOKUP not working?

A few errors come up again and again:

Is XLOOKUP available in my Excel?

XLOOKUP is in Excel for Microsoft 365, Excel 2021, Excel 2024, and later. It is not in Excel 2016 or Excel 2019. If a workbook built with XLOOKUP is opened in one of those older versions, the formula shows a #NAME? error, so it’s worth knowing which version your colleagues run before you rely on it in a shared file. When you need a formula that works everywhere, INDEX and MATCH is the version-proof alternative that, like XLOOKUP, can look in any direction.

The short version

For a new lookup on current Excel, prefer XLOOKUP. Give it the value, the column to search, and the column to return; add an if_not_found message so a miss reads clearly; and leave the match and search modes on their exact, top-to-bottom defaults unless you have a reason not to. When you need where a value sits rather than the value itself, XMATCH is the same idea in position form. If you’re moving a shared model off VLOOKUP, compare the workbook before and after so you can confirm the numbers didn’t move when the formulas did.

Frequently asked questions

What is XLOOKUP, and how is it different from VLOOKUP?
XLOOKUP looks for a value in one column or row and returns the matching value from another. Unlike VLOOKUP it can return a column to the left of the one it searches, it defaults to an exact match, and it has a built-in argument for what to show when nothing is found. It replaces both VLOOKUP and HLOOKUP.
How do I use XLOOKUP?
The three required arguments are the value to find, the array to search, and the array to return: =XLOOKUP(lookup_value, lookup_array, return_array). For example =XLOOKUP(D2, A2:A5, C2:C5) searches A2:A5 for the value in D2 and returns the matching cell from C2:C5. Add a fourth argument to control the not-found result.
Is XLOOKUP better than VLOOKUP?
For most new formulas, yes. XLOOKUP searches in any direction, matches exactly by default (so it can't silently return the wrong row), returns an array rather than a hard-coded column number, and handles a missing match without wrapping it in IFNA. VLOOKUP's one advantage is that it works in every version of Excel, while XLOOKUP needs Microsoft 365 or Excel 2021 and later.
Why is my XLOOKUP returning #N/A?
XLOOKUP returns #N/A when it can't find the lookup value and you haven't supplied the fourth argument. Check that the value really is in the lookup array, that the two sides are the same data type (a number is not the same as text that looks like a number), and that there are no stray spaces. To show your own message instead, add an if_not_found value, for example =XLOOKUP(D2, A2:A5, C2:C5, "Not found").
Can XLOOKUP use multiple criteria?
Yes. Because the lookup array can be an expression, you can match on more than one column at once. A common pattern is =XLOOKUP(1, (A2:A5="North")*(B2:B5="Q1"), C2:C5), which finds the row where both conditions are true, or concatenating the keys with =XLOOKUP(F2&G2, A2:A5&B2:B5, C2:C5).
Is XLOOKUP available in my version of Excel?
XLOOKUP is in Excel for Microsoft 365, Excel 2021, Excel 2024, and later. It is not in Excel 2016 or Excel 2019. If you open a workbook that uses XLOOKUP in one of those older versions, the formula shows a #NAME? error.

Catch the errors before they ship

Reviewing a change to a model? Compare the two versions in your browser and see every changed cell, formula, and value. It's free, and nothing leaves your computer.