FORMULAS & FUNCTIONS

How to Use XLOOKUP in Excel

XLOOKUP finds a value in one column and returns the matching value from another. This beginner tutorial uses a small price list to fill in product names and prices from a SKU, flag missing codes, apply quantity discounts and look up to the left, then checks every result against the source data.

Excel order sheet where XLOOKUP returns the product name USB-C Hub for SKU OX-202 from a price list, with a $1,228.80 order total.
The finished result: an order sheet that pulls names, prices and discounts from one price list.

What you will build

We will build a simple order sheet for a small office-supply business. A price list holds eight products, a small table holds quantity discounts, and five order lines use XLOOKUP to fill in everything except the SKU and quantity you type.

AreaCellsWhat it holds
Price listA1:D9SKU, Product, Category, Unit Price
Discount tiersF1:G5Min Qty 1, 10, 25, 50 with discounts of 0%, 5%, 10%, 15%
Find SKU by nameF7:G9A product name to search and the SKU it returns
Order linesA12:F18Order SKU, Product, Unit Price, Qty, Discount, Line Total and the order total
Everything sits on one sheet so you can see the source and the result side by side.

XLOOKUP is available in Excel for Microsoft 365, Excel 2021 and later, and Excel for the web. In older versions it shows #NAME?; use INDEX and MATCH instead. If you already know the basics and only need strict ID matching, the XLOOKUP exact match guide goes deeper on that one topic.

Free download: Get the XLOOKUP sample workbook (.xlsx) and follow along. Yellow cells are inputs, and every formula in this tutorial is already in place.

Understand the XLOOKUP syntax

XLOOKUP needs only three arguments. The other three are optional and you can leave them out until you need them.

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])
ArgumentIn plain EnglishIn our example
lookup_valueWhat you are looking forThe SKU in A13
lookup_arrayWhere to look for itThe SKU column, A2:A9
return_arrayWhat to bring back from the same rowThe Product column, B2:B9
[if_not_found]What to show when there is no match“SKU not found”
[match_mode]0 = exact (default), -1 = exact or next smaller, 1 = exact or next larger, 2 = wildcard-1 for discount tiers
[search_mode]1 = first to last (default), -1 = last to firstNot needed here

A simple way to remember it: find this, look here, return that. Microsoft’s XLOOKUP function reference lists every option.

Step 1: Set up the price list and order table

A lookup is only as reliable as the table behind it. Spend a minute on the source data before you write any formulas.

  1. Enter the headers SKU, Product, Category and Unit Price in A1:D1, then the eight products in rows 2 to 9.
  2. Enter the discount tiers in F1:G5: Min Qty 1, 10, 25, 50 and Discount 0%, 5%, 10%, 15%. Sort the Min Qty column from smallest to largest.
  3. In A12:F12, enter the order headers Order SKU, Product, Unit Price, Qty, Discount and Line Total.
  4. Type the five order SKUs in A13:A17 (OX-202, OX-101, OX-203, OX-999, OX-302) and the quantities in D13:D17 (12, 60, 4, 10, 25). OX-999 is a deliberate typo so we can test a missing code.
  5. Make sure every SKU appears only once in the price list.
Excel sheet with a price list in A1:D9, discount tiers in F1:G5 and empty order lines in A12:F17 ready for XLOOKUP formulas.
One row per product, a unique SKU in column A, and input cells clearly marked.
Checkpoint: SKUs in the order table must match the price list character for character. A trailing space or a number stored as text will cause a “not found” result later. If your data came from another system, run it through this extra-spaces cleanup first.

Step 2: Write your first XLOOKUP

Start with the product name. Click B13 and enter:

=XLOOKUP(A13,$A$2:$A$9,$B$2:$B$9,"SKU not found")

Excel takes the SKU in A13 (OX-202), searches for it in A2:A9, finds it in row 6, and returns the value from the same row of B2:B9: USB-C Hub. There is no column number to count, and the result will not break if you insert a column into the price list later.

Excel formula bar showing =XLOOKUP(A13,$A$2:$A$9,$B$2:$B$9,"SKU not found") with the lookup value, lookup array and return array highlighted, returning USB-C Hub in B13.
Lookup value in orange, lookup array in blue, return array in green, matched row in purple.
Checkpoint: B13 should show USB-C Hub. If you see #NAME?, your Excel version does not support XLOOKUP. If you see #N/A, check the SKU for extra spaces.

Step 3: Copy the formula down and handle missing SKUs

The dollar signs in $A$2:$A$9 lock the price list so it stays put when you copy the formula, while A13 moves down to A14, A15 and so on. Press F4 after selecting a range to add the dollar signs quickly (see how F4 toggles references).

  1. In C13, return the unit price from column D:
    =XLOOKUP(A13,$A$2:$A$9,$D$2:$D$9,0)
  2. Select B13:C13 and drag the fill handle down to row 17, or select B13:C17 and press Ctrl+D.
  3. Look at row 16. OX-999 is not in the price list, so B16 shows SKU not found and C16 shows $0.00 instead of #N/A.
Excel order lines B13:C17 filled with XLOOKUP results, with B16 showing SKU not found for the mistyped SKU OX-999.
The fourth argument replaces #N/A with a message that tells the user what went wrong.

Why two different “not found” values? The Product column shows a visible warning so the row is easy to spot. The Unit Price column returns 0 so the line total and order total still calculate instead of spreading an error through the sheet.

Watch out: A friendly message hides the error, not the problem. Before you send the order or invoice, fix the SKU in A16 rather than leaving a $0.00 line in place.

Step 4: Use approximate match for discount tiers

Discount tiers do not list every possible quantity. You want “the highest tier the quantity qualifies for”, and that is what match_mode -1 does: it finds an exact match or, if there is none, the next smaller value. In E13 enter:

=XLOOKUP(D13,$F$2:$F$5,$G$2:$G$5,0,-1)

Copy it down to E17. Row 14 orders 60 units. There is no 60 in the tier list, so XLOOKUP falls back to the next smaller threshold, 50, and returns 15%. Row 16 orders exactly 10, which is an exact match, so it gets 5%. Row 15 orders 4, which falls back to the 1-unit tier at 0%.

Excel XLOOKUP with match mode -1 returning a 15% discount in E14 for a quantity of 60, matched to the 50-unit tier in F5:G5.
match_mode -1 reads the tier table like a price break sheet: equal to or just below.

Now add the line total in F13 with =C13*D13*(1-E13), copy it down to F17, and total the order in F18 with =SUM(F13:F17).

Checkpoint: E13:E17 should read 5%, 15%, 0%, 5% and 10%. If a quantity below 1 is possible, add a 0 tier, otherwise XLOOKUP has no smaller value to fall back to and returns the if_not_found value.

Step 5: Look up to the left

Sometimes you know the product name but need the SKU, and the SKU column sits to the left of the name. VLOOKUP cannot do this on its own. XLOOKUP does not care about direction because the lookup array and return array are separate arguments.

  1. Type Laptop Stand in G8.
  2. In G9, enter:
    =XLOOKUP(G8,$B$2:$B$9,$A$2:$A$9,"Not found")
  3. The result is OX-203, taken from column A of the matching row.
Excel XLOOKUP searching the Product column B2:B9 for Laptop Stand and returning SKU OX-203 from column A in cell G9.
Search column B, return column A. The direction does not matter to XLOOKUP.

Text lookups are not case-sensitive, so “laptop stand” also works. They do need the same spelling and no extra spaces. To let users pick a name instead of typing it, add a drop-down list to G8.

Step 6: Verify the results

A formula that returns something is not the same as a formula that returns the right thing. Check at least one row by hand before you rely on the sheet.

  1. Row 13: OX-202 is the USB-C Hub at $34.50. 12 units qualify for the 10-unit tier (5%), so 12 × $34.50 × 95% = $393.30.
  2. Row 14: 60 × $4.50 × 85% = $229.50.
  3. Row 15: 4 × $27.75 × 100% = $111.00.
  4. Row 16: OX-999 is not in the price list, so the line is $0.00 and flagged in column B.
  5. Row 17: 25 × $22.00 × 90% = $495.00.
  6. Total: F18 should show $1,228.80.
Completed Excel order sheet with XLOOKUP results, line totals in F13:F17 and an order total of $1,228.80 in F18.
Final checkpoint: every line total can be traced back to the price list and tier table.
Ready-to-share test: Change A16 to OX-103. B16 should show Stapler, C16 $8.90, and the total should rise by $84.55 (10 × $8.90 × 95%) to $1,313.35.

XLOOKUP vs VLOOKUP at a glance

TaskVLOOKUPXLOOKUP
Default match typeApproximate (unless you add FALSE)Exact
Return a column to the leftNoYes
Survives inserted columnsNo, the column number shiftsYes
Custom “not found” messageNeeds IFERROR or IFNABuilt in
Works in Excel 2016 and olderYesNo

If a key can match several rows and you need all of them, XLOOKUP will only return the first. Use FILTER for multiple results instead.

Common mistakes and quick fixes

What you seeLikely causeFix
#N/A for a SKU you can see in the listExtra spaces, hidden characters, or text vs number mismatchClean the source with TRIM, or see how to fix numbers stored as text.
Results go wrong after you copy the formula downThe lookup and return ranges were not lockedUse $A$2:$A$9, or convert the price list to an Excel Table.
#VALUE!Lookup array and return array are different sizesMake both ranges cover the same rows, such as A2:A9 and B2:B9.
#NAME?Your Excel version does not include XLOOKUP, or the name is misspelledCheck the spelling, or use INDEX and MATCH.
Wrong discount tiermatch_mode left at the default (exact), or the tier table has gapsAdd -1 as the fifth argument and list every tier threshold, including the lowest.
The wrong product is returnedDuplicate SKUs in the price listXLOOKUP returns the first match. Remove or correct the duplicates.

Frequently asked questions

Is XLOOKUP better than VLOOKUP?

For most new workbooks, yes. It defaults to an exact match, can look left, does not break when columns are inserted, and has a built-in not-found message. Stick with VLOOKUP or INDEX and MATCH only when the file must open in Excel 2019 or older.

Do I have to use all six arguments?

No. Only the first three are required. Add if_not_found for cleaner reports and match_mode when you need tiers or wildcards.

Can XLOOKUP return more than one column?

Yes. In Microsoft 365, =XLOOKUP(A13,$A$2:$A$9,$B$2:$D$9) returns Product, Category and Unit Price at once and spills them into the next cells. Keep those cells empty or you will see #SPILL!.

Does XLOOKUP work with an Excel Table?

Yes, and it is a good idea for lists that grow. With a table named tblPrices, the formula becomes =XLOOKUP(A13,tblPrices[SKU],tblPrices[Product],"SKU not found") and new products are included automatically.

Why does my approximate match return the wrong tier?

Check that you used -1 (next smaller) rather than 1 (next larger), and that every threshold is a real number. Unlike VLOOKUP, XLOOKUP does not need the tier table sorted for match_mode -1, but sorting it makes the table easier to review.

Final checklist

  • The price list has one row per product and no duplicate SKUs.
  • Lookup and return ranges are locked with $ or use an Excel Table.
  • Lookup and return ranges cover the same rows.
  • Missing SKUs show a clear message instead of #N/A.
  • Discount tiers use match_mode -1 and include the lowest threshold.
  • At least one line total has been checked by hand, and the order total matches.

Once this works, you can reuse the same pattern in an invoice tracker, an inventory reorder sheet, a payroll rate table or a commission schedule. The idea stays the same: find this, look here, return that, and then check the answer against the source.

Practice file: Download the XLOOKUP sample workbook. The “How It Works” sheet lists every formula and what it does.

Build lookups that hold up in real work

Browse the OneXcel Tutorial Hub for more formula guides, or explore ready-to-use Excel templates.

Discover more from OneXcel Studio

Subscribe now to keep reading and get access to the full archive.

Continue reading