XLOOKUP function in Excel
Searches a range or an array, and returns an item corresponding to the first match it finds. If a match doesn't exist, then XLOOKUP can return the closest (approximate) match.
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])XLOOKUP syntax and parameters
Six arguments, three required.
- lookup_valueanyRequired
The value to search for *If omitted, XLOOKUP returns blank cells it finds in lookup_array.
- lookup_arrayarrayRequired
The array or range to search
- return_arrayarrayRequired
The array or range to return
- if_not_foundanyOptional
Where a valid match is not found, return the [if_not_found] text you supply.If a valid match is not found, and [if_not_found] is missing, #N/A is returned.
- match_modenumberOptional
Specify the match type:0 - Exact match. If none found, return #N/A. This is the default.-1 - Exact match. If none found, return the next smaller item.1 - Exact match. If none found, return the next larger item.2 - A wildcard match where *, ?, and ~ have special meaning.
- search_modenumberOptional
Specify the search mode to use:1 - Perform a search starting at the first item. This is the default.-1 - Perform a reverse search starting at the last item.2 - Perform a binary search that relies on lookup_array being sorted in ascending order. If not sorted, invalid results will be returned.-2 - Perform a binary search that relies on lookup_array being sorted in descending order. If not sorted, invalid results will be returned.
XLOOKUP examples
Formulas you'll actually reuse.
Price lookup that says so when the product is missing:
=XLOOKUP(E2, Products[SKU], Products[Price], "Not stocked")Result
24.99Search from the bottom to get the latest order:
=XLOOKUP(E2, Orders[Customer], Orders[Date], , 0, -1)Result
2026-08-14
XLOOKUP in Google Sheets
Same name — your formula ports as-is.
Try XLOOKUP in the playground
Edit the example — nothing to install.
Preloaded with the XLOOKUP formula from Example 1 — change anything and watch it respond.
XLOOKUP errors
What they mean — and the fixes.
#N/ANo match and no if_not_found fallback — pass a fourth argument so missing lookups read as data, not errors.
#VALUE!lookup_array and return_array have different lengths — both must span the same number of rows or columns.
Related functions
More ways Excel gets this done.
- FILTERFilters a range of data based on criteria you defineLookupGoogle Sheets
- SORTSorts the contents of a range or arrayLookupGoogle Sheets
- XMATCHReturns the relative position of an item in an array or range of cells.LookupGoogle Sheets
- AVERAGEIFReturns the average (arithmetic mean) of all the cells in a range that meet a given criteriaStatisticalGoogle Sheets
- CELLReturns information about the formatting, location, or contents of a cellThis function is not available in Excel for the web.InfoGoogle Sheets
- CSCReturns the cosecant of an angleMathGoogle Sheets