How to Use XLOOKUP in Excel (Better Than VLOOKUP)

To use XLOOKUP in Excel, write =XLOOKUP(lookup_value, lookup_array, return_array) — it searches one column for your value and returns the matching item from another, in either direction. Unlike VLOOKUP, it can look left, defaults to an exact match, and won’t break when you insert a column.

The syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentWhat it isRequired?
lookup_valueWhat you’re searching forYes
lookup_arrayThe column to searchYes
return_arrayThe column to return fromYes
if_not_foundWhat to show when there’s no matchOptional
match_modeExact (0), exact-or-next (1), wildcard (2)Optional — defaults to exact
search_modeFirst-to-last (1), last-to-first (-1), binaryOptional

The first three arguments are all you need for a normal lookup.

A worked example

Say you have a product table: A = product ID, B = product name, C = price.

To find the price for the ID in E2:

=XLOOKUP(E2, A2:A100, C2:C100)

That’s it — no column counting, no fourth argument to remember.

What XLOOKUP fixes about VLOOKUP

Problem with VLOOKUPXLOOKUP
Can only look right of the lookup columnWorks either direction
Must count the column number (3)You pass the return column directly
Defaults to approximate matchDefaults to exact
Breaks when you insert a columnImmune — ranges are explicit
Returns #N/A on no matchCan return your own message

That last one is a genuine improvement. Instead of an ugly error:

=XLOOKUP(E2, A2:A100, C2:C100, "Not found")

Handling no-match properly

The if_not_found argument is worth using in almost every sheet:

=XLOOKUP(E2, A2:A100, C2:C100, "")

Empty string for a clean blank, or a message like "Check the ID" to flag a data problem. Either beats a column of #N/A.

Looking left (the VLOOKUP workaround you no longer need)

VLOOKUP can’t return a value from a column to the left of what it searches. XLOOKUP has no such limit:

=XLOOKUP(E2, C2:C100, A2:A100)

That searches the price column and returns the product ID — impossible with VLOOKUP without restructuring the data or using INDEX/MATCH.

Returning several columns at once

Point return_array at more than one column and XLOOKUP spills all of them:

=XLOOKUP(E2, A2:A100, B2:D100)

That returns the name, price, and stock for the matching row across three cells. It’s a clean way to pull a whole record.

The other optional arguments

Match mode — change how strictly it matches:

ValueBehaviour
0 (default)Exact match only
-1Exact, or the next smaller item
1Exact, or the next larger item
2Wildcard (* and ?)

Search mode — which end to start from:

ValueBehaviour
1 (default)First to last
-1Last to first — finds the most recent match

search_mode: -1 is genuinely useful for logs and transaction lists, where you want the latest entry rather than the first.

Availability

XLOOKUP requires Microsoft 365 or Excel 2021 or later. It does not exist in Excel 2019, 2016, or older, and it’s not in Excel for the web’s older compatibility modes.

On an older version, use INDEX/MATCH instead — it does everything XLOOKUP does, just with more typing:

=INDEX(C2:C100, MATCH(E2, A2:A100, 0))

If you’re migrating from VLOOKUP, see how to use VLOOKUP in Excel for the differences in practice, and VLOOKUP not working for the errors you can stop worrying about.

Common problems

ProblemFix
#NAME? errorYour Excel version predates XLOOKUP — use INDEX/MATCH
#VALUE!The lookup and return arrays are different lengths
Returns the wrong rowDuplicate values in the lookup column — XLOOKUP returns the first unless you set search_mode to -1
#N/A despite an obvious matchA trailing space or a number stored as text. Try =XLOOKUP(TRIM(E2), ...)
Spill error when returning several columnsThere isn’t room beside the formula — clear the cells it needs

For more on the functions around it, Google Sheets formulas for beginners covers the basics, and how to use VLOOKUP in Google Sheets covers the Sheets equivalent if you’re not on Excel.

FAQ

What does XLOOKUP do in Excel?

It searches one range for a value and returns the matching item from another range — in either direction, with an exact match by default.

Is XLOOKUP better than VLOOKUP?

Yes, for almost everything. It looks both left and right, defaults to exact matching, survives column inserts, and lets you set your own “not found” message.

Does XLOOKUP work in older Excel versions?

No — it needs Microsoft 365 or Excel 2021+. On Excel 2019 and earlier, use INDEX/MATCH instead.

Can XLOOKUP return a value to the left?

Yes. Point lookup_array at the right-hand column and return_array at the left one — =XLOOKUP(E2, C2:C100, A2:A100). VLOOKUP can’t do this.

How do I stop XLOOKUP showing #N/A?

Use the fourth argument: =XLOOKUP(E2, A2:A100, C2:C100, "Not found"). It shows your text instead of the error when there’s no match.