Home  /  Blog  /  Lookup & Filter
Lookup & Filter

XLOOKUP Function in Excel — How to Use It (With 9 Examples)

By admin 26 November 2026 Lookup & Filter

XLOOKUP is Excel’s modern lookup function, and it does what VLOOKUP does with fewer ways to go wrong. You give it three things — the value to find, the range to search, and the range to return from — and it finds the match and returns the answer. Exact match is the default, it looks left or right, and it has a built-in answer for when the value is not there. It is not in every Excel: it needs Microsoft 365, Excel 2021 or Excel 2024, and it does not exist in Excel 2019 or earlier, or in Google Sheets. This guide teaches it in nine examples, all on the same table, with every answer checked by hand — and it ends with the honest cases where VLOOKUP is still the right call.

Quick takeaway: three arguments do the job; the other three are for the hard cases.

  • =XLOOKUP(102, A2:A5, D2:D5) — find 102 in A2:A5, return the matching price from D2:D5. Answer: 399.
  • The six arguments: lookup_value, lookup_array, return_array — then the optional if_not_found, match_mode, search_mode.
  • Exact match is the default. You do not write FALSE the way VLOOKUP makes you.
  • Microsoft 365, Excel 2021 or Excel 2024 only. Not Excel 2019,
  • not Google Sheets.
XLOOKUP Function in Excel — How to Use It (With 9 Examples)

The Syntax — Six Arguments, Three That Matter

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentRequired?What it does
lookup_valueYesThe value to search for — a number, text, or a cell reference
lookup_arrayYesThe range to search in
return_arrayYesThe range to return the answer from
if_not_foundNoWhat to show when there is no match (instead of #N/A)
match_modeNo0 = exact (default), −1 = next smaller, 1 = next larger, 2 = wildcard
search_modeNo1 = search from the first (default), −1 = search from the last

Three arguments do the job. The last three are for the hard cases: not found, approximate match, and last match. Learn the first three, then add the others one at a time.

The Table Every Example Uses

The same four-row product table from the XLOOKUP vs VLOOKUP guide — so every answer here matches that guide exactly.

ABCDE
SKUProductCategoryPriceStock
101Laptop StandAccessories45120
102Standing DeskFurniture39912
103Office ChairFurniture24930
104Monitor ArmAccessories8975

Example 1 — Exact Match: The Price of SKU 102

=XLOOKUP(102, A2:A5, D2:D5)

Search A2:A5 for 102, return the matching item from D2:D5: 399. That is the whole job — three arguments, one answer, exact match by default. No FALSE to remember, no column to count.

Example 2 — Left Lookup: The Product for a Price

VLOOKUP cannot do this at all, because the price sits to the right of the product name. XLOOKUP does not care which side the answer is on — the lookup range and the return range are separate.

=XLOOKUP(399, D2:D5, B2:B5)

Search D2:D5 for 399, return the matching product from B2:B5: “Standing Desk”. The lookup range (prices, column D) is to the right of the return range (products, column B), and XLOOKUP handles it the same way.

Example 3 — Not Found: Your Own Message Instead of #N/A

=XLOOKUP(999, A2:A5, D2:D5, "Not found")

SKU 999 is not in the table. Without the fourth argument, XLOOKUP returns #N/A. With it, it returns “Not found” — a message your reader understands, instead of an error code. Use a number instead of text when the result feeds another calculation: =XLOOKUP(999, A2:A5, D2:D5, 0).

Example 4 — Return the Whole Matching Row

The return range can be more than one column. XLOOKUP returns the whole row at once, spilled across the cells.

=XLOOKUP(102, A2:A5, B2:E5)

Result, spilled across four cells: Standing Desk | Furniture | 399 | 12. One formula, four answers, and they stay in step with the table — change the price and the spilled result changes with it.

Example 5 — Last Match, Not First

XLOOKUP looks from the top and returns the first match by default. Its search_mode argument can scan from the bottom up with −1, returning the last match. VLOOKUP cannot do this at all.

Example: an order log where the same customer appears several times. Ali’s orders: 100, then 150, then 175. To find Ali’s last order:

=XLOOKUP("Ali", A2:A6, B2:B6, , , -1)

Result: 175 — the last Ali in the list, not the first (100). Note the two empty arguments: the fourth (if_not_found) and fifth (match_mode) are left blank with two commas, so the −1 lands in the sixth argument, search_mode.

Example 6 — Approximate Match: Discount Tiers

Sometimes you do want an approximate match — the next smaller or next larger value. XLOOKUP’s match_mode handles it: −1 for next smaller, 1 for next larger, and it works on unsorted data.

ThresholdDiscount
00%
1005%
50010%
1,00015%

An order of 750 falls in the 500–999 band, so the discount is 10%:

=XLOOKUP(750, A2:A5, B2:B5, , -1)

Result: 10%. The −1 means “exact or next smaller”: 750 is not in the list, so XLOOKUP takes 500, the largest value below it, and returns 10%. VLOOKUP’s approximate match only works when the first column is sorted in ascending order — on unsorted data it returns wrong results without warning. So if you need an approximate match, XLOOKUP is not just easier, it is safer.

Example 7 — Partial Match: Search by Part of a Name

You remember part of a product name, not the whole thing. Set match_mode to 2 for a wildcard match, and use * for “anything”:

=XLOOKUP("*Stand*", B2:B5, D2:D5, , 2)

Result: 45 — the first product whose name contains “Stand” is the Laptop Stand (SKU 101), and its price is 45. The * on both sides means “anything before and after”. Without the 2, XLOOKUP looks for the literal text “Stand” and finds nothing.

Example 8 — Two-Way Lookup: Nested XLOOKUP

Find a value by its row AND its column — a product and a quarter, and the number where they meet. The inner XLOOKUP finds the column, the outer one finds the row.

Q1Q2
Laptop Stand120145
Standing Desk1218

The sales of the Standing Desk in Q2:

=XLOOKUP("Standing Desk", A2:A3, XLOOKUP("Q2", B1:C1, B2:C3))

Check it: the inner XLOOKUP(“Q2”, B1:C1, B2:C3) returns the Q2 column, {145, 18}. The outer XLOOKUP(“Standing Desk”, A2:A3, {145, 18}) returns 18 — the second row, which is the Standing Desk. One formula, no helper cells.

Example 9 — Multiple Criteria: Two Tests at Once

Find the price of the Furniture item with stock above 20. Two tests, one lookup:

=XLOOKUP(1, (C2:C5="Furniture")*(E2:E5>20), D2:D5)

Check it: the Furniture rows are 102 (stock 12) and 103 (stock 30). Only 103 passes both tests — Furniture AND stock above 20 — so the result is 249, the price of the Office Chair. The trick is the 1: each test gives TRUE or FALSE, multiplying them gives 1 only where both are true, and XLOOKUP finds the 1.

Does XLOOKUP Work in Your Excel?

VersionXLOOKUP?
Microsoft 365Yes
Excel 2021Yes
Excel 2024Yes
Excel for the webYes
Excel 2019No
Excel 2016No

If the file must open in Excel 2019 or earlier, do not use XLOOKUP — the people opening it will see #NAME? instead of an answer. Use INDEX+MATCH instead: the same job in two steps, and it works in every version. That is the one case where the older function wins.

Does Google Sheets Have XLOOKUP?

No. Google Sheets does not have XLOOKUP. If you paste an XLOOKUP formula into Sheets, it shows #NAME?. In Sheets, use VLOOKUP or INDEX+MATCH for the same job — or the FILTER function when you need every matching row. This is an Excel site, so the Sheets versions are not taught here; the point is to stop you pasting the wrong formula into the wrong app.

Common Mistakes

MistakeWhat happensFix
You used XLOOKUP in Excel 2019#NAME? — the function does not exist in your versionUse INDEX+MATCH, or upgrade to Microsoft 365
You left out the return range#VALUE! — XLOOKUP needs all three required argumentsAdd the return range: =XLOOKUP(value, lookup_range, return_range)
The lookup value is a number, the column is text#N/A — 102 and “102” are different values to a lookupMake both the same type; check for text with ISTEXT
You forgot the empty commas before search_modeThe −1 lands in match_mode, not search_modeWrite both commas: =XLOOKUP("Ali", A2:A6, B2:B6, , , -1)
You used match_mode 2 without wildcards#N/A — mode 2 expects * or ? in the valueAdd the asterisks: "*Stand*", or drop the 2
You copied the formula down without locking the rangesThe ranges move with the formula and the answers go wrongLock them: =XLOOKUP(A2, $A$2:$A$5, $D$2:$D$5) — see the absolute reference guide
The spilled row has #SPILL!Something is in the way of the spilled cellsClear the cells to the right of the formula

Frequently Asked Questions

What is XLOOKUP in Excel? A lookup function that searches one range for a value and returns the matching item from another range. Syntax: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]).

How do I use XLOOKUP in Excel? Type =XLOOKUP(, then the value to find, the range to search, and the range to return from, then close the bracket. For example: =XLOOKUP(102, A2:A5, D2:D5) returns 399.

What is the difference between XLOOKUP and VLOOKUP? XLOOKUP searches one range and returns from another, so it looks left or right and survives column inserts; VLOOKUP searches the first column of a range and counts across, so it only looks right and breaks on inserts. XLOOKUP matches exactly by default; VLOOKUP needs FALSE written every time.

Does XLOOKUP work in Excel 2019? No. XLOOKUP needs Microsoft 365, Excel 2021 or Excel 2024. In Excel 2019 or earlier, use INDEX+MATCH.

How do I find the last match with XLOOKUP? Set search_mode to −1: =XLOOKUP("Ali", A2:A6, B2:B6, , , -1). The two empty commas keep the −1 in the sixth argument.

How do I return multiple values with XLOOKUP? Give it a return range wider than one column — =XLOOKUP(102, A2:A5, B2:E5) spills the whole row. For every matching row (not one match), use the FILTER function instead.

Can XLOOKUP do a partial match? Yes — set match_mode to 2 and use wildcards: =XLOOKUP("*Stand*", B2:B5, D2:D5, , 2).

Does Google Sheets have XLOOKUP? No. Sheets does not have XLOOKUP. Use VLOOKUP or INDEX+MATCH in Sheets.

That is XLOOKUP: three arguments for the everyday job, three more for the hard cases — not found, approximate match, last match — and nine examples on one table to prove each one works. It is simpler than VLOOKUP and safer than VLOOKUP, and for most people on Microsoft 365 it should be the default lookup. The two exceptions are worth remembering: if the file must open in Excel 2019, use INDEX+MATCH, and if you are in Google Sheets, XLOOKUP does not exist at all. Try it on your own table now, with the product table above, and when you want the four lookup functions compared side by side, the Excel lookup functions topic page is next — and the Excel Formulas hub has the full learning order for the whole site.


About admin

Author of Excel formula guides on this blog.

View all guides by admin →

Keep Learning

Related guides