The XLOOKUP function

Finds a value in one range and returns the matching item from another. Exact match by default, with an optional value for not found.

Syntax

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
lookup_value
The value to find.
lookup_array
The range to search.
return_array
The range to return from, the same size as lookup_array.
if_not_found (optional)
What to return when there is no match, instead of #N/A.
match_mode (optional)
0 exact (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcards.
search_mode (optional)
1 first to last (default), -1 last to first.

Examples

D1=XLOOKUP("Plum",A2:A4,B2:B4)
ABCD
1FruitPrice5
2Apple4
3Pear6
4Plum5

In plain words: Find Plum in the fruit in A2:A4 and return its price from B2:B4.

D1=XLOOKUP("Kiwi",A2:A4,B2:B4,"Not found")
ABCD
1FruitPriceNot found
2Apple4
3Pear6
4Plum5

Practice XLOOKUP

Read the guide

Questions

Which Excel versions have XLOOKUP?

Excel for Microsoft 365, Excel 2021 and later, Excel for the web and Google Sheets. Excel 2019 and older do not.

Related functions