Excel function

XLOOKUPfunction

Finds a value in one range and returns the value at the same position in another range. It can return values to the left, too.

Excel 2021+
=XLOOKUP("Eggs", B2:B9, C2:C9)
Range to drag
A
B
C
D
1
2
3
4
5
6
7
8
9

Click a cell to change lookup_value. Drag the corner dots to change lookup_array, return_array. Move return_array to column A to return the product code on the left, something VLOOKUP cannot do. Try breaking it on purpose to see the errors.

Result

6900

lookup_value

The value to find.

lookup_array
B2:B9Drag a corner dot up/down to resize, sideways to change the column

The single column to search.

return_array
C2:C9

The column to return a value from. It can be on either side of lookup_array.

if_not_found

What to return when nothing is found. Leave it empty to get #N/A.

match_mode

How to match: exact, next smaller, next larger, or wildcard.

search_mode

Search from the first item or from the last item.

What is the XLOOKUP function?

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

XLOOKUP finds a value in one range (lookup_array) and returns the value at the same position in another range (return_array). Because the two ranges are separate, the return column can be to the left or the right.

It defaults to an exact match, lets you choose what to show instead of #N/A, and can search from the bottom up to find the last match.

XLOOKUP is available in Microsoft 365 and Excel 2021 or later. It is not available in Excel 2019 or earlier.

Arguments

lookup_value
The value to find.
lookup_array
The range to search, usually a single column.
return_array
The range to return a value from. It must have the same number of rows as lookup_array.
if_not_found
Optional. Returned when there is no match. If omitted, the result is #N/A.
match_mode
0 exact match (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard match with * and ?.
search_mode
1 searches from first to last (default). -1 searches from last to first, which finds the last match.

XLOOKUP examples

  1. Example 1. Return a price by product name

    =XLOOKUP("Eggs", B2:B9, C2:C9)

    Finds Eggs in column B and returns 6900 from the same row of column C.

  2. Example 2. Return a value from the left

    =XLOOKUP("Eggs", B2:B9, A2:A9)

    The return range is to the left of the lookup range. The result is P004. VLOOKUP cannot do this.

  3. Example 3. Show a message instead of #N/A

    =XLOOKUP("Pear", B2:B9, C2:C9, "Not found")

    Pear is not in the list, so the formula returns "Not found" instead of an error, without wrapping it in IFERROR.

Common mistakes

FAQ

Is XLOOKUP better than VLOOKUP?
It is more flexible: exact match by default, any return direction, and a built-in fallback. VLOOKUP still matters when files must work in older Excel.
How do I find the last match?
Set search_mode to -1 so the search starts at the bottom.