Lookup

Google Sheets XLOOKUP Function — Syntax, Examples & Tips

Learn how to use XLOOKUP in Google Sheets as a modern replacement for VLOOKUP. Includes exact match, reverse search, wildcard, and missing-value handling.

Syntax
=XLOOKUP(search_key, lookup_range, result_range, [missing_value], [match_mode], [search_mode])

What XLOOKUP Does

XLOOKUP searches a column for a value and returns a corresponding value from another column — in any direction. It replaces VLOOKUP and HLOOKUP with a single, more flexible function. It also has built-in handling for missing values, so you don't need to wrap it in IFERROR.

Syntax

=XLOOKUP(search_key, lookup_range, result_range, [missing_value], [match_mode], [search_mode])
ParameterDescription
search_keyThe value to search for.
lookup_rangeThe row or column to search.
result_rangeThe row or column from which to return the result.
missing_valueValue to return if no match is found. Defaults to #N/A.
match_mode0 = exact (default), 1 = next larger, -1 = next smaller, 2 = wildcard.
search_mode1 = first to last (default), -1 = last to first, 2 = binary ascending, -2 = binary descending.

Basic Examples

Example 1: Look Up a Customer Email

ABC
1IDNameEmail
2C01Lenalena@acme.com
3C02Marcomarco@globex.com
=XLOOKUP("C02", A2:A3, C2:C3)

Result: marco@globex.com

Example 2: Default Value When Not Found

=XLOOKUP("C99", A2:A3, C2:C3, "Not found")

Result: Not found — no IFERROR needed.

Example 3: Return Multiple Columns

XLOOKUP can return an entire row of results if the result range spans multiple columns:

=XLOOKUP("C01", A2:A3, B2:C3)

Result: Lena | lena@acme.com (spills into two cells)

Advanced Examples

Reverse Search — Last Match

Find the most recent order for a customer by searching from bottom to top:

=XLOOKUP("Lena", B2:B500, D2:D500, "No orders", 0, -1)

Setting search_mode to -1 starts from the last row, so it returns the latest entry for "Lena."

Approximate Match — Tax Bracket

Given income brackets in ascending order, find the applicable tax rate:

AB
1IncomeRate
2010%
34000022%
48500032%
=XLOOKUP(55000, A2:A4, B2:B4, , -1)

Result: 22% — match_mode -1 finds the largest value less than or equal to 55,000.

Common Mistakes

  • Using XLOOKUP in older sheets shared with Excel users. XLOOKUP is supported in Google Sheets and Excel 365, but not in Excel 2019 or earlier. If collaborators use older versions, the formula will break on their end.
  • Mixing up match_mode and search_mode. Match_mode controls what kind of match (exact, next larger, wildcard). Search_mode controls direction (first-to-last, last-to-first). Confusing the two leads to unexpected results.
  • Lookup and result ranges of different sizes. Both ranges must have the same number of rows (or columns for horizontal lookups). A mismatch returns an error.

SheetAI Tip

Don't want to memorize this syntax? With SheetAI, just type what you need in plain English — like "look up the email for customer C02" — and the formula is generated for you. Install SheetAI to try it free.

Skip the formula. Describe what you need.

SheetAI lets you type what you want in plain English and generates the perfect formula — no syntax to memorize.

Try SheetAI Free