XLOOKUP in Google Sheets

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

In Google Sheets

Google Sheets added XLOOKUP in 2022 with the same arguments in the same order, including the value for when nothing is found, match mode and search mode.

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

Related functions