
Section: Excel & Google Sheets
XLOOKUP in Google Sheets finds a value in one range and returns the matching value from another, in either direction. =XLOOKUP("Apple",A2:A,E2:E) looks down the product column and returns the price from column E. There is no column counting, no sorted data requirement and no left-to-right limit, which is why it replaces most VLOOKUP formulas. This guide covers the six arguments, the match and search modes, the differences from Excel's version and the errors you will meet. The sample data is made up.
What XLOOKUP does
The function searches a lookup range for a key. When it finds the key, it returns the value at the same position in a result range. The lookup range must be a single row or column. The result range must have the same length along that lookup dimension; it can span several columns or rows for a multi-field result. Because the result range is chosen separately, it can sit to the left of the lookup column, which VLOOKUP cannot do without rearranging the sheet.
The syntax
=XLOOKUP(search_key, lookup_range, result_range, [missing_value], [match_mode], [search_mode])
- search_key is what you are looking for, such as a product code or a name.
- lookup_range is the row or column to search.
- result_range is the row or column to return from, at the matched position.
- missing_value is optional and defaults to #N/A. Put your own text here to avoid an error on screen.
- match_mode is optional and defaults to 0 for an exact match. 1 allows an exact match or the next larger value, -1 the next smaller, and 2 does a wildcard match.
- search_mode is optional and defaults to 1, which searches from the first entry to the last. -1 searches backwards, and 2 and -2 use a binary search on data sorted ascending or descending.
Those definitions come from Google's own function page, and they matter: the match modes are what make the function useful for price bands and date ranges, not just exact lookups.

A basic lookup
- Type the key in a cell, for example H2.
- Enter =XLOOKUP(H2,$A$2:$A$200,$E$2:$E$200).
- Press Enter. The matching value appears.
- Copy the formula down for the other keys.
Lock the ranges with dollar signs so the copy does not shift them. If the sheet grows, use open ended ranges such as A2:A and E2:E, which Google supports and which avoid editing the formula every month.
Replace the #N/A with a message
Add the fourth argument: =XLOOKUP(H2,$A$2:$A$200,$E$2:$E$200,"Not found"). A miss now shows the words instead of an error. This is the single biggest readability improvement over VLOOKUP, where you need a wrapper function to do the same job.

Approximate matches
Match mode 1 selects the next larger value on a miss; -1 selects the next smaller. For a band defined by a lower threshold, use -1: =XLOOKUP(A2,$H$2:$H$6,$I$2:$I$6,,-1) finds the band that starts at or below the value. Set the table in ascending order and the result is a lookup that behaves like a rate card. The same idea works for dates, where a lookup finds the most recent entry before a given day.
Search direction
The default search starts at the top and returns the first match. With search_mode -1 it starts at the bottom, so a list where the newest record is last returns the latest entry. That replaces the old trick of sorting the data backwards before a lookup. The binary search modes, 2 and -2, are faster on large sorted ranges and return wrong answers on unsorted ones, so use them only when you are sure the data is sorted.

Return a whole row or column
If the result range is more than one row or column, the function returns the entire row or column at the matched position. That is how you pull a whole record with one formula: set the result range to the full table block and the output spills across the fields. It is the Sheets equivalent of a multi column return in a lookup formula.
XLOOKUP compared with VLOOKUP
VLOOKUP counts columns from the left, so inserting a column breaks it, and it cannot look leftwards. XLOOKUP takes the result range directly, so inserting columns is safe. VLOOKUP also needs FALSE for an exact match, which people forget, and it returns #N/A with no way to supply a message except with IFERROR. For new sheets, use XLOOKUP. Keep VLOOKUP in old files that work, and see our guide to VLOOKUP in Google Sheets when you have to repair one.
Differences from Excel's XLOOKUP
The arguments are the same six, and the meanings are close, but the two are separate functions with separate help pages. Google's page notes that search_mode is not supported in XLOOKUP for BigQuery, which is a Sheets only data source. In Excel, the same function has been available since Microsoft 365 and 2021, and the Excel XLOOKUP guide covers the Microsoft version. If a workbook moves between the two, test the lookup before you trust it, especially where approximate matches are involved.

Common errors
- #N/A. The key is not in the lookup range, often because of a trailing space or a number stored as text. Clean the key first.
- #REF! or a size error. The lookup range and the result range are different sizes, or the lookup range is a two-dimensional block. A multi-column result range is allowed for a vertical lookup.
- Wrong match returned. The lookup range contains duplicates. The function returns the first match by default, or the last with search_mode -1.
- Numbers will not match. One side is text and the other is a number. Convert with VALUE with VALUE where appropriate. Changing number formatting alone does not reliably convert text into numbers.
- Slow sheet. Open ended ranges on a huge sheet cost time. Limit them to the used rows.
Questions and answers
Does Google Sheets XLOOKUP work like Excel's?
Closely, with the same six arguments. Treat them as separate functions and test anything that moves between the two.
Can XLOOKUP return several columns at once?
Yes. Give a multi column result range and the output spills across the fields for the matched row.
Do I still need INDEX and MATCH?
Not for new formulas, though the INDEX MATCH pattern is still useful to recognise in old files and works in both apps.
Is XLOOKUP faster than VLOOKUP?
For a normal size sheet the difference is not noticeable. The binary search modes help on large sorted ranges.
Can I use XLOOKUP across two spreadsheets?
Yes, if the other sheet is connected with IMPORTRANGE, or if both sheets are open in the same file as separate tabs.
