Home / Formulas / XLOOKUP
Lookup Excel + Google Sheets

XLOOKUP function in Excel

What is XLOOKUP in Excel? It searches a range for a value and returns a matching result from another range — no column counting, no VLOOKUP fragility. Available in Excel 365, Excel 2021, and Google Sheets.

XLOOKUP syntax & arguments

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

The first three arguments are enough for most exact-match lookups. Keep lookup_array and return_array the exact same height (or width for horizontal lookups).

1 lookup_value
Required

The value to find. It can be text, a number, a cell reference (e.g. E2), or the result of another formula.

2 lookup_array
Required

The row or column where Excel should search for lookup_value (e.g. A2:A6).

3 return_array
Required

The row, column, or table range to return from the matching position (e.g. C2:C6). Must match lookup_array dimensions.

4 if_not_found
Optional

The fallback result to return when no match is found (e.g. "Not found"). If omitted, Excel returns #N/A.

5 match_mode
Optional

Controls exact, approximate, or wildcard matching:

  • 0 — Exact match (default: returns a result only on exact match)
  • -1 — Exact or next smaller (useful for tiered rates/tax brackets)
  • 1 — Exact or next larger
  • 2 — Wildcard match (supports *, ?, ~)
6 search_mode
Optional

Controls search direction or binary search method:

  • 1 — First to last (default: searches top-down)
  • -1 — Last to first (searches bottom-up; perfect for finding the latest entry)
  • 2 — Binary ascending (requires sorted data)
  • -2 — Binary descending (requires reverse-sorted data)

Excel XLOOKUP example

Column A lists employee IDs, column B lists names, and column C lists salaries. Cell E2 contains the ID to find: E-102.

Employee IDNameSalary
E-101Ana72000
E-102Ben64000
E-103Chen81000
E-104Dia59000
E-105Eli77000
=XLOOKUP(E2, A2:A6, C2:C6, "Not found")

XLOOKUP searches A2:A6 for E-102 and returns 64000 from the same row in C2:C6. If the ID is missing, the formula returns Not found instead of #N/A.

How to use XLOOKUP in Excel

  1. Identify the lookup value and search column — Decide what you want to find (lookup_value, e.g. the employee ID in E2) and the row or column that contains those values (lookup_array, e.g. A2:A6).
  2. Point to the result column — Set return_array to the range holding the answer (e.g. C2:C6 for salaries). It must match the height of lookup_array exactly.
  3. Enter the formula and handle misses — Type =XLOOKUP(E2, A2:A6, C2:C6) and press Enter. Add "Not found" as the fourth argument so misses return friendly text instead of #N/A.

XLOOKUP with multiple criteria

Basic XLOOKUP matches a single value. To apply two or more conditions at once — say, find the salary for a given employee in a given department — multiply the boolean tests or join the values into one key:

Method 1: boolean multiplication (recommended)

=XLOOKUP(1, (A2:A6=E2) * (B2:B6=F2), C2:C6, "Not found")

Each test returns TRUE/FALSE; multiplying them leaves 1 only where every condition is true, and XLOOKUP finds that row.

Method 2: concatenation

=XLOOKUP(E2&"|"&F2, A2:A6&"|"&B2:B6, C2:C6, "Not found")

Join criteria and ranges with a separator (&) so both sides form one combined lookup key. The same patterns also power two-way lookups that match a row and a column at once.

XLOOKUP vs VLOOKUP

XLOOKUP

Look up left or right. No column index number to count. Default exact match. Clean built-in not-found fallback.

VLOOKUP

Look up only to the right. Fragile when columns move or insert. Easy to forget the FALSE / 0 exact-match flag.

XLOOKUP vs INDEX MATCH

XLOOKUP

One function instead of two. Built-in if_not_found — no wrapping IFERROR. Identical syntax for left, right, or last-match lookups.

INDEX MATCH

Runs in every Excel version, including pre-2021 releases without XLOOKUP. Handles two-way lookups naturally with a row MATCH and a column MATCH inside INDEX.

Common mistakes & caveats

  • #N/A — No exact match found; check trailing spaces, leading zeros, or text-vs-number formatting.
  • #VALUE! — lookup_array and return_array have different lengths or dimensions.
  • Fill formula down errors — Remember to lock ranges with $ (e.g. $A$2:$A$6) before dragging.

Intro XLOOKUP practice problem

Solve the problem directly in this locked Mini sheet with instant grading, or open it on its dedicated page.

Open full problem →
Description
Hints 0/4
Solutions 3
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

Related practice problems

Practice combining XLOOKUP and logic formulas in realistic, less-prescriptive spreadsheet challenges.

FAQ

What is the XLOOKUP function in Excel?

XLOOKUP is a lookup function available in Excel 365/2021 and Google Sheets. It searches a range (lookup_array) for a value and returns the item at the same position from another range (return_array), replacing both VLOOKUP and HLOOKUP.

What is the basic XLOOKUP syntax?

Use =XLOOKUP(lookup_value, lookup_array, return_array). The first three arguments cover most exact-match lookups.

What's the difference between VLOOKUP and XLOOKUP?

XLOOKUP can look left or right, needs no column index number, defaults to exact match, and includes a built-in if_not_found argument. VLOOKUP only looks right and breaks when columns are inserted or moved.

Is XLOOKUP better than VLOOKUP?

For most modern workbooks, yes. XLOOKUP can look left or right, needs no column index, defaults to exact match, and supports a custom not-found message.

XLOOKUP vs INDEX MATCH: which is better?

XLOOKUP is simpler — one function with a built-in not-found fallback. INDEX MATCH is still the right choice for Excel versions older than 2021, or for classic two-way lookups that match a row and a column at once.

Does XLOOKUP work in Google Sheets?

Yes. Google Sheets supports XLOOKUP with the same six-argument syntax, including if_not_found, match_mode, and search_mode.

How do I use XLOOKUP with multiple criteria?

Multiply boolean tests: =XLOOKUP(1, (A2:A6=E2)*(B2:B6=F2), C2:C6). Or concatenate the criteria into one key: =XLOOKUP(E2&F2, A2:A6&B2:B6, C2:C6).

Why do I get #N/A with XLOOKUP?

Usually there is no exact match. Check trailing spaces, text-vs-number mismatches, or confirm both arrays are the same height.