Formulas > Lookup > XLOOKUP

Excel XLOOKUP Formula Examples

Debra Dalgleish - Contextures

These Excel XLOOKUP formula examples show how to get a value from one column, based on a value in a different column. For example, enter a code, and get the matching product name.

XLOOKUP formula examples find product name

Video: XLOOKUP Function Examples

The XLOOKUP function is a lookup that will work either as a vertical lookup or a horizontal lookup.

  • The XLOOKUP function is in the Lookup Function category of Excel functions.
  • XLOOKUP is only available in MS 365 or Excel 2021 or later.

In this short video, I show 2 examples of using the Excel XLOOKUP function.

XLOOKUP Syntax

The XLOOKUP function has the following 5 arguments in its syntax:

  • XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]) 

The first three arguments are required:

  • lookup_value - Value to search for
  • lookup_array- Where to look for the lookup value - range (row or column), or array
  • return_array- Where get return value - range (row or column), or array

The remaining three arguments are optional:

  • [if_not_found]- Value to return if a valid match is not found
    • If not used, and valid match not found, #N/A error is returned
  • [match_mode]- Type of match to return - exact or wildcard
    • If not used, the default of match type 0 (exact) is used
  • [search_mode]- Where to start search - from first item or last item
    • If not used, default search mode (0 - from first item) is used

Tip: Get more XLOOKUP info in the Down the Rabbit Hole section.

Ex 1: Item Name for Product Code

In this example, there's a product code in cell F2.

I'll build an XLOOKUP formula in cell G2, that will:

  • find that code in column C
  • from that code's row, return the item name in column A

use XLOOKUP to get the item name

Here's where all of the information is located on the worksheet:

  • XLOOKUP formula will be entered in cell G2
  • Product code has been entered in cell F2
  • Lookup table is named tblProductsXLK2
  • Product code lookup column heading is Code
  • Item names to return are in column named Item

XLOOKUP Formula

Here is the formula in cell G2, with references to cell F2, and the table columns named Code and Item:

  • =XLOOKUP($F$2,  tblProductsXLK2[Code],  tblProductsXLK2[Item],  "Not Found")

In cell G2, the formula result is the product name, "Sweater".

In the lookup table shown below, you can see that Sweater is the correct result:

  • product code SW001 is in cell C5
  • product name from that row, in cell A5, is Sweater

The next section has details on how this formula works.

XLOOKUP formula find product name for code

How XLOOKUP Formula Works

Here is the formula in cell G2, with the function's four arguments colour coded:

  • =XLOOKUP(
    1. $F$2,
    2. tblProductsXLK2[Code],
    3. tblProductsXLK2[Item],
    4. "Not Found")

In that formula, the XLOOKUP function uses these 4 arguments:

  1. lookup value - look for product code entered in cell F2
  2. lookup array- look in the Code column
  3. return array- return related value the Item column
  4. [if not found]- if product code isn't found, show result, "Not Found"

Excel XLOOKUP function arguments colour coded

To get the result, the XLOOKUP function:

  • finds the code, SWoo1, in the Code column, in cell C5
  • returns product name from the same row, in Item column, cell A5

Excel XLOOKUP function steps

Ex 2: Latest Product Price

In this example, we'll use XLOOKUP to get the latest price from a lookup table, for a specific product code.

Here's where all of the information is located on the worksheet:

  • XLOOKUP formula will be entered in cell B3
  • Product code has been entered in cell A3
  • Lookup table is named tblProd_b
  • Product code lookup column is named Code
  • Item prices to return are in column named Price

IMPORTANT: For this example, the lookup table is sorted by the Date column, from earliest date to latest date.

use XLOOKUP to get the latest price

XLOOKUP Formula - Latest Price

Here is the formula in cell B3, with references to cell A3, and the table columns named Code and Price:

  • =XLOOKUP($A3, tblProd_b[Code], tblProd_b[Price], "Not Found", 0, -1)

In cell B3, the formula result is the price of 32.

In the lookup table shown below, you can see that Sweater is the correct result:

  • searching from the bottom up, JK001 is in cell A12
  • in that row, the price is 32

The next section has details on how this reverse search formula works.

Excel XLOOKUP function lookup table check

How XLOOKUP Formula Works

Here is the formula in cell G2, with the function's first 3 arguments colour coded:

  • =XLOOKUP(
    1. $F$2,
    2. tblProductsXLK2[Code],
    3. tblProductsXLK2[Item],
    4. "Not Found"
    5. 0
    6. -1)

In that formula, the XLOOKUP function uses these 6 arguments:

  1. lookup_value - look for product code entered in cell F2
  2. lookup_array- look in the Code column
  3. return_array- return related value the Item column
  4. [if_not_found] - if product code isn't found, show result, "Not Found"
  5. [match_mode]- 0 - find an exact match for the product code
  6. [search_mode]- -1 - start search from last item in lookup column

Excel XLOOKUP function arguments colour coded

To get the result, the XLOOKUP function:

  • starting from last row, moving up, finds JKoo1, in Code column, in cell A12
  • returns product price from the same row, in Price column, cell E12

Excel XLOOKUP function steps

Ex 3: Rate - Approx Match

In this example, we'll use XLOOKUP to get the commission rate from a lookup table, using an approximate match.

There are two lookup tables, to show the two ways an approximate match can be found:

  • Next Smaller: Look for the amount in column A (Min), or the next smaller amount
  • Next Larger: Look for the amount in column D (Max), or the next larger amount

In the following tables, the XLOOKUP function does these steps::

  1. Looks for amount in table's first column, or approximate match
    • 5th argument (match mode), tells Excel which type of match to return:
      • -1 is for an exact match, or the next smaller amount
      • 1 is for an exact match, or the next larger amount
  2. Returns value from column named Rate, in the amount's row
  3. If an approximate match for the amount is not found, result is "X"

XLOOKUP Formula - Approximate Match

Next Smaller

Here is the formula in cell B12, where formula should look for an exact match for the amount in cell A2, or the next smaller amount:

  • =XLOOKUP(A12, tblMin[Min], tblMin[Rate],"X", -1)
    • table name is tblMin
    • lookup column is named Min
    • return column is named Rate

Next Larger

Here is the formula in cell E12, where formula should look for an exact match for the amount in cell A2, or the next larger amount:

  • =XLOOKUP(D12, tblMax[Max], tblMax[Rate],"X", 1)
    • table name is tblMax
    • lookup column is named Max
    • return column is named Rate.

use XLOOKUP to get an approximate match

Ex 4: Get Multiple Columns

In this example, we'll use XLOOKUP to return the values from 3 columns in a lookup table, for a specific product code.

In the following table, the XLOOKUP function does these steps::

  1. Finds the row for product code entered in cell F2
  2. Returns value from column named Item, in the product code's row
  3. If a match for the product code is not found, result is "Not Found"

XLOOKUP Formula - Multiple Columns

Here is the formula in cell G2, using table references.

  • =XLOOKUP($F$2,  tblProductsXLK2[Code],  tblProductsXLK2[Item],  "Not Found")

The table name is tblProductsXLK2, the lookup column is named Code, and the return column is named Item.

XLOOKUP Formula - Multiple Columns

Get the Excel Files ✅

  • Examples 1 and 2: To see the first two XLOOKUP function examples from this page, download the XLOOKUP function samples (1/2) workbook. The zipped file is in xlsx format, and does not contain any macros.
  • Examples 3 and 4: To see XLOOKUP function examples 3 and 4, from this page, download the XLOOKUP function examples (3/4) workbook. The zipped file is in xlsx format, and does not contain any macros.

Get Monthly Excel Tips!

Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.

Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!

Down the Rabbit Hole 🐰

In this section, you'll find related Excel tips, shortcuts, skills, and details. These things are nice to know, but not essential, so you can skip this section, and get back to work. Or dive in, for some extra Excel fun and knowledge!

--a) XLOOKUP: Pros

--b) XLOOKUP: Cons

--c) XLOOKUP Reference Styles

--d) Try XLOOKUP - Interactive

a) XLOOKUP: Pros

  • Very flexible -- look for value in any row or column.
  • Can find an exact or approximate match
  • Can find first or last matching item
  • By using 2 XLOOKUP functions in one formula, can find both the row and the column
  • Can return multiple cells using SPILL
  • Can use multiple criteria
  • Can find "*" and "?" as a character, as well as the option to use them as a wildcard.
  • Result is a cell or range, so there is the option to use the address in another formula such as SUM, instead of simply returning the value from the cell(s).
  • These are not volatile functions, so they have less impact on calculations in a large workbook

b) XLOOKUP: Cons

  • Only available in MS 365 or Excel 2021 or later
  • Using 2 XLOOKUPs to find row and column is less intuitive than the similar INDEX / MATCH -MATCH function combination

c) XLOOKUP Reference Styles

When you're building a formula in an Excel spreadsheet, you can click on a worksheet cell, to refer to that cell in your formula.

Depending on where that cell is located, Excel can create a:

  1. worksheet cell reference, such as A2
  2. structured table reference, such as tblSales[Region]
  3. named range reference, such as SelCode

c.1) Examples on This Page

The examples on this page use the following reference types:

  1. worksheet cell references for cells that are not in a named Excel table
  2. structured table references for lookup columns in named Excel tables
  3. there are no named range references in these examples

For example, this formula has a worksheet reference to cell F2, and structured table references to the Code and Item columns in the table named tblProductsXLK2

  • =XLOOKUP($F$2,  tblProductsXLK2[Code],  tblProductsXLK2[Item],  "Not Found")

c.2) Worksheet Cell References

Even though Excel automatically creates structured table references for table cells, you can use worksheet cell references, if you prefer.

For example, here is the same formula (shown above), with worksheet addresses, instead of table references.

  • =XLOOKUP($F$2, $C$4:$C$12,  $A$4:$A$12,  "Not Found")

You might find that reference style easier to read, if you've been using Excel for a long time, like I have!

Also, using this cell reference style makes it easier to copy formulas across a row, when you need an absolute reference to one or more of the table columns. The video below shows that problem.

d) Try XLOOKUP - Interactive Examples

In the embedded Excel workbook shown below, you can see XLOOKUP function examples, and try this function for yourself - even if XLOOKUP is not available in your version of Excel.

  • NOTE: The interactive file might not be viewable on all devices or browsers.

This workbook uses Excel for the Web, where XLOOKUP is available, along with more of the newest Excel functions,

Tip: At the bottom right of the embedded workbook, click the icon to open the workbook online, full sized.

click icon to open full-sized workbook online

More Lookup Functions

INDEX MATCH Formula

FILTER Function

Compare Lookup Functions

VLOOKUP

CHOOSE

LOOKUP

Lookup - 2 Criteria

 

 

VLOOKUP

 

Last updated: September 6, 2026 2:52 PM