The XLOOKUP Function in Excel

Excel Functions
Sep 08, 2025 4 min read
XLOOKUP Function in Excel

The XLOOKUP function in Excel is newly introduced in the latest version of Excel, which is a powerful replacement for older lookup functions like VLOOKUP, HLOOKUP, and LOOKUP. It allows you to search for a value in a range or array and return a corresponding value from another range, with much more flexibility and fewer limitations.

Syntax:

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

Arguments:

  1. lookup_value (required): The value you want to search from your range of cells.
  2. lookup_array (required): The range where your lookup_value is available for Excel to search.
  3. return_array (required): The range from which you want the result.
  4. [if_not_found] (optional): The value you want to display if there is no result found for the lookup_value (e.g., "Not Found").
  5. [match_mode] (optional): Defines how Excel matches values: 
    • 0 → Exact match (default)
    • -1 → Exact match or next smaller item
    • 1 → Exact match or next larger item
    • 2 → Wildcard match (*, ?, ~ supported)
  6. [search_mode] (optional): Defines the search direction/ orderr:
    • 1 → Search first to last (default)
    • -1 → Search last to first (reverse)
    • 2 → Binary search ascending
    • -2 → Binary search descending

Explanation of Syntax and Arguments

  • lookup_value (required): This is the item you want Excel to find. It might be an employee code, a product ID, or any unique entry stored in your dataset.
  • lookup_array (required): The range of cells where Excel should look for that value. Unlike VLOOKUP, you’re not limited to the first column — you can tell XLOOKUP to search anywhere.
  • return_array (required): The range of cells that holds the answer you want to retrieve. The beauty of XLOOKUP is that it doesn’t matter if this data is to the left, right, above, or below the lookup column — it works in any direction.
  • [if_not_found] (optional): Instead of showing an error when a match isn’t found, you can set XLOOKUP to display a custom message (for example, “ID Missing” or “Not Found”).
  • [match_mode] (optional): Tells Excel how to compare your lookup value to the list. You can go for an exact match, the closest smaller/larger value, or even enable wildcard searches.
  • [search_mode] (optional): Defines the direction Excel searches in. You can keep it default (top to bottom) or flip it (bottom to top).

How to Use the XLOOKUP Function

Think of XLOOKUP like a smarter version of VLOOKUP that removes old restrictions where it supports only looking for the value in the first column of your dataset and then returning results from the right, as XLOOKUP can return and look from anywhere in the range.

You can use XLOOKUP for:

  • Employee lookups
  • Product price automation
  • Grade conversions
  • Commission rate lookups
  • Clean error handling and wildcard searches

If you have older versions of Excel, find out complete guide on VLOOKUP

Examples of XLOOKUP Function

Example 1: Finding Employee Department

Scenario:

You have employee IDs in column B and want to find the department from column D.

VLOOKUP Function to find from Employee ID in Excel

Formula:

=XLOOKUP(F3, B2:B12, D2:D12, "Not Found")

Explanation:

If you type an employee ID into cell F3, XLOOKUP scans the ID list in column B and fetches the matching department name from column D. If the ID isn’t found, instead of showing #N/A, you’ll see a clear message like “Not Found.”

Example 2: Looking Up Product Prices

Scenario:

You need product prices from a product list when you type in product codes.

XLOOKUP Function in Excel

Formula:

=XLOOKUP(F3, ProductTbl[Product Code], ProductTbl[Price], "Code Not Found")

Explanation:

When you type a product code in F3, XLOOKUP searches the Code column and returns the Price. If the product code doesn’t exist, it shows "Code Not Found".

Example 3: Converting Scores to Grades

Scenario:

A teacher wants to convert numeric scores into grades using a grade table.

XLOOKUP Function in Excel

Formula:

=XLOOKUP(C3, GradeTbl[Score], GradeTbl[Grade], , -1)

Explanation:

The student’s score in C3 is compared with the grade table. By using -1 (Exact match or next smaller item), scores that don’t match exactly still fall into the correct grade range.

Example 4: Finding Commission Rates

Scenario:

A sales team earns commissions based on their sales range.

XLOOKUP Function in Excel

Formula:

=XLOOKUP(C3, CommissionTbl[Sales Amount], CommissionTbl[Commission Rate], , -1)

Explanation:

If someone sold $18,000 and the exact number isn’t in the table, XLOOKUP finds the next smaller sales bracket and returns the correct commission rate.

Combining XLOOKUP with Other Functions

Example 1: XLOOKUP with IFERROR for Cleaner Results

Scenario:

You want a polished report without ugly error messages.

XLOOKUP with IFERROR Function

Formula:

=IFERROR(XLOOKUP(C9,B2:B7,C2:C7),"Employee Not Found")

Explanation:

If the employee ID isn’t found, Excel shows "Employee Not Found" instead of an error.

Example 2: XLOOKUP with Wildcards

Scenario:

You only know part of a product name but want to look it up.

XLOOKUP with wildcards

Formula:

=XLOOKUP("*"&F3&"*", ProductWildcardTbl[Product Name], ProductWildcardTbl[Price], "No Match", 2)

Explanation:

The 2 (Wildcard match) option allows partial matches, so typing "Phone" will match "Smartphone" or "Headphone".

Example 3: Reverse Search with XLOOKUP

Scenario:

You want to find the last sale made by a salesperson instead of the first.

XLOOKUP Reverse Search

Formula:

=XLOOKUP(B11, SalesTable[Salesperson], SalesTable[SaleDate],"No Record",0,-1)

Explanation:

The -1 search mode tells Excel to search from bottom to top, so you get the last matching record.

Why Use XLOOKUP Instead of VLOOKUP?

  • No need to count columns (use named ranges directly).
  • Work in any direction of the dataset or a range of cells.
  • Built-in [if_not_found] argument avoids extra IFERROR.
  • Supports wildcards for partial matches.
  • Can search last-to-first instead of only top-to-bottom.

Download XLOOKUP practice file

Feel free to download and practice to master the XLOOKUP funciton in Excel.

XLOOKUP is one of the most powerful functions in modern Excel and makes your formulas simpler, smarter, and cleaner. Whether you’re working with employee databases, product catalogs, or financial models, XLOOKUP can save you time and reduce formula errors.

Comments (0)

Leave a Comment

Comments are moderated before publishing.

No comments yet. Be the first to comment!

Quick Tip

Press Ctrl+Shift+L to quickly add filters to your data range.