AI · 2 min read

XLOOKUP

XLOOKUP function in Google Sheets: Searches range, returns match.

Google Sheets functions / Lookup & Reference
Lookup & Reference function · Google Sheets

XLOOKUP function

XLOOKUP finds a value in one range and returns the matching value from another. It looks left or right, defaults to an exact match, and has a built-in message for missing items.

Syntax

=XLOOKUP(search_key, lookup_range, result_range, [missing_value], [match_mode], [search_mode])
Switch to the Excel page

Arguments

ArgumentRequiredMeaning
lookup_valueYesThe value to find.
lookup_arrayYesThe range to search.
return_arrayYesThe range that holds the answer.
if_not_foundNoText or a value to show when nothing matches.
match_modeNo0 exact (default), -1 next smaller, 1 next larger, 2 wildcard.
search_modeNo1 first to last (default), -1 last to first.

Worked example

ABC
1SKUProductPrice
2A-101Keyboard45
3A-102Mouse22
4A-103Monitor180
5A-104Dock95
=XLOOKUP("A-103",A2:A5,C2:C5,"Not found")
Result: 180

The formula searches the SKU column for A-103 and returns the price from the same row.

Try it

Edit the formula and run it against the table above. Results come from a browser spreadsheet engine.

Availability

PlatformStatus
ExcelMicrosoft 365, Excel 2024, Excel 2021, Excel for the web. Not in Excel 2019 or older.
Google SheetsAvailable.

Common mistakes

  • Lookup and return ranges with different sizes return an error.
  • A number stored as text will not match a real number.
  • Workbooks shared with Excel 2019 users will show an error for this function.

Do it with AI

Paste this prompt into Copilot, Gemini or another assistant. Check the result on a small sample first.

I have SKUs in column A and prices in column C. Write an XLOOKUP that returns the price for the SKU in F2 and shows "Not found" when it is missing.