Start practice

XLOOKUP

AI for Excel ·

XLOOKUP finds something in one column and returns the matching value from another: the price of a product code, the amount of an order number, the email of an employee ID. It replaces VLOOKUP for most jobs because it is easier to read and does not break when columns move.

Syntax

Formula
=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
  • lookup_value: what you are looking for, for example 1005 or a cell like H1.
  • lookup_array: the column to search in, for example A2:A9.
  • return_array: the column to return from, for example E2:E9.
  • if_not_found (optional): what to show when there is no match, for example "Not found".
  • match_mode and search_mode (optional): exact match is the default; you rarely need these.

Examples

The examples use this sheet, data in rows 2 to 9:

RowA OrderC RegionD ProductE Amount
21001WestLaptop1200
31002EastMonitor300
41003WestMonitor250
51004NorthLaptop1100
61005EastLaptop1300
71006WestKeyboard80
81007NorthMonitor280
91008WestLaptop1150

Return a number

Question: what is the amount of order 1005?

Formula
=XLOOKUP(1005,A2:A9,E2:E9)

Result: 1,300. XLOOKUP finds 1005 in row 6 of column A and returns row 6 of column E.

Return text, from a column to the left

Question: which region is order 1007 from?

Formula
=XLOOKUP(1007,A2:A9,C2:C9)

Result: North. The return column can be anywhere, left or right of the search column.

A friendly message when nothing matches

Formula
=XLOOKUP(H1,A2:A9,E2:E9,"Not found")

With 1010 in H1 the result is "Not found" instead of #N/A.

Return several columns at once

Formula
=XLOOKUP(1003,A2:A9,C2:E9)

Returns West, Monitor and 250 in three cells next to each other. Leave room to the right, or you get a #SPILL! error.

Variants

XLOOKUP vs VLOOKUP

XLOOKUPVLOOKUP
Return columnAny column, left or rightOnly to the right
How you name itA range, like E2:E9A column number, like 4
Default matchExactApproximate unless you add FALSE
Not found messageBuilt inNeeds IFERROR
Breaks when a column is insertedNoYes, the number shifts

The VLOOKUP version of the first example is =VLOOKUP(1005,A2:E9,5,FALSE). It works, but the 5 breaks if someone inserts a column.

No XLOOKUP in your version

Older Excel versions do not have XLOOKUP. INDEX and MATCH do the same job: =INDEX(E2:E9,MATCH(1005,A2:A9,0)) returns 1,300. Google Sheets supports XLOOKUP.

Approximate matches

For tiers like discount levels, set match_mode to -1 (exact or next smaller). Sort is not required, but check the tiers carefully.

Common errors

#N/A

The value was not found. Common causes: an extra space, or a number stored as text in one column and as a number in the other. Add an if_not_found value, and clean the data. More in Excel formula not working.

#NAME?

Your Excel version does not have XLOOKUP, or the name is misspelled. Use INDEX and MATCH.

#VALUE!

The search and return ranges have different sizes, such as A2:A9 and E2:E8.

The wrong row comes back

The return range starts on a different row from the search range, such as A2:A9 and E3:E10. Both must start and end on the same rows.

When you ask AI for a lookup, say which column holds the key and which holds the value you want, and whether the key is a number or text. That one detail prevents most #N/A surprises.

Practice

In the level "Write it yourself" you type lookups and other formulas on a realistic sheet; each answer is checked on the sheet and on changed copies of it. The earlier levels show how to ask AI for formulas and read them, and the SUMIFS guide covers totals with conditions.

Start step by step: Write it yourself

Free, in your browser, no sign up. Opens level “Write it yourself”.

FAQ

What is the difference between XLOOKUP and VLOOKUP?

XLOOKUP can return a column on either side, uses ranges instead of column numbers, matches exactly by default and has a built in not found value. VLOOKUP only looks to the right and breaks when columns move.

Why does XLOOKUP return #N/A?

The lookup value is not in the search column exactly as written. Check for spaces and for numbers stored as text, or add a not found value as the fourth argument.

Is XLOOKUP available in Google Sheets?

Yes. Google Sheets supports XLOOKUP with the same arguments.

Can XLOOKUP return more than one column?

Yes. Give a return range several columns wide, and the results spill into the cells to the right.

For learning only. Nothing here is legal, financial or tax advice. Sample AI replies in the practice are written in advance, and all names and numbers are made up.