toolrota

Excel XLOOKUP explained: a more powerful replacement for VLOOKUP

XLOOKUP is the most flexible way to find a value in Excel and return its match. Look left, right and even for the last match with a single formula, without VLOOKUP's limits.

Serkan Akyürek··3 min read
Excel XLOOKUP explained: a more powerful replacement for VLOOKUP – Excel

XLOOKUP is the lookup function available in Microsoft 365 and Excel 2021 or later. It finds a value in a table and returns another value from the same row (or column). It fixes almost every weakness of the long-serving VLOOKUP.

XLOOKUP syntax

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentWhat it does
lookup_valueThe value you are looking for, such as a product code
lookup_arrayThe column or row to search
return_arrayThe column or row to return the result from
if_not_foundText to show when there is no match (optional)
match_mode0 exact match (default), -1 / 1 next smaller/larger, 2 wildcards
search_mode1 searches first to last, -1 last to first

Note: English Excel separates arguments with commas. Many European versions, including Turkish and German, use semicolons.

Basic example: get a price by product code

Product codes are in column A and prices in column C. To find the price for the code in F2:

=XLOOKUP(F2, A2:A500, C2:C500)

Unlike VLOOKUP, you do not count a column index. You select the return column directly, so inserting a new column does not break the formula.

Looking up to the left

VLOOKUP can only return values from columns to the right of the lookup column. XLOOKUP has no such limit. To find the product code (column A) from the product name (column C):

=XLOOKUP(F2, C2:C500, A2:A500)

Showing a not-found message

If the value does not exist, XLOOKUP returns #N/A. Use the fourth argument for a friendly message, with no need to wrap the formula in IFERROR:

=XLOOKUP(F2, A2:A500, C2:C500, "Product not found")

Finding the last match

To find a customer's most recent order, start searching from the bottom of the list by setting the sixth argument to -1:

=XLOOKUP(F2, B2:B5000, D2:D5000, "No orders", 0, -1)

Returning several columns at once

If the return array covers several columns, XLOOKUP "spills" the results side by side. To get product name, category and price with one formula:

=XLOOKUP(F2, A2:A500, B2:D500)

The cells to the right must be empty; otherwise you get a #SPILL! error.

XLOOKUP vs VLOOKUP

FeatureVLOOKUPXLOOKUP
Look up to the leftNoYes
Default matchApproximate (careful!)Exact
Breaks when columns are insertedYesNo
Not-found messageNeeds IFERRORBuilt in
Search from the bottomNoYes
AvailabilityAll versionsMicrosoft 365, Excel 2021+

Common mistakes

  • Arrays of different sizes: lookup_array and return_array must have the same number of rows, or you get #VALUE!.
  • Numbers vs text: If a code is stored as a number in one place and as text in another, no match is found. Convert codes to one type.
  • Extra spaces: Invisible spaces prevent matches. Clean them with TRIM.
  • Older Excel: Someone opening the file in Excel 2016 or 2019 sees #NAME? instead. In that case use INDEX and MATCH.

Summary

XLOOKUP is more readable, safer and more flexible. We recommend it as your default lookup in new workbooks. If you share files with people on older versions, keep INDEX/MATCH in mind as a fallback.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.