
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])| Argument | What it does |
|---|---|
lookup_value | The value you are looking for, such as a product code |
lookup_array | The column or row to search |
return_array | The column or row to return the result from |
if_not_found | Text to show when there is no match (optional) |
match_mode | 0 exact match (default), -1 / 1 next smaller/larger, 2 wildcards |
search_mode | 1 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
| Feature | VLOOKUP | XLOOKUP |
|---|---|---|
| Look up to the left | No | Yes |
| Default match | Approximate (careful!) | Exact |
| Breaks when columns are inserted | Yes | No |
| Not-found message | Needs IFERROR | Built in |
| Search from the bottom | No | Yes |
| Availability | All versions | Microsoft 365, Excel 2021+ |
Common mistakes
- Arrays of different sizes:
lookup_arrayandreturn_arraymust 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.
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.