FormulaFix · Plain-English guides to Excel and Google Sheets formulas

How to Use XLOOKUP in Excel: A Step‑by‑Step Guide


What is XLOOKUP and Why Use It?

XLOOKUP is Excel’s modern replacement for the older lookup functions — VLOOKUP, HLOOKUP, and the INDEX + MATCH combo. It was introduced in Excel 365 and Excel 2021 (or later).

Feature XLOOKUP VLOOKUP / HLOOKUP
Search direction Up, down, left, right Only down (VLOOKUP) or right (HLOOKUP)
Return column Any column, not just the one to the right Must be to the right of the lookup column
Default match Exact (0) Approximate unless you set the fourth argument
Missing‑value handling Built‑in if_not_found argument Requires an extra IFERROR/IFNA wrapper
Array support Works with dynamic arrays Needs CSE in older versions

Why Switch to XLOOKUP?

Quick example

=XLOOKUP("Apple", A2:A6, B2:B6, "Not found")
A (Product) B (Price)
Apple 1.20
Banana 0.80
Cherry 2.50
Date 3.00
Elderberry 4.10

Result: 1.20 (price for “Apple”). If “Apple” is missing, the formula returns “Not found” instead of #N/A.


XLOOKUP Syntax and Parameters

XLOOKUP(lookup_value, lookup_array, return_array,
        [if_not_found], [match_mode], [search_mode])
Argument Description Required? Typical values
lookup_value Value to find Yes Cell reference, text, number, etc.
lookup_array Range where Excel searches Yes Single column/row, e.g., A2:A100
return_array Range that holds the result Yes Same size as lookup_array
if_not_found Value returned when no match is found No "Not found" or 0; default is #N/A
match_mode Type of match No 0 exact (default)
-1 exact or next smaller
1 exact or next larger
2 wildcard (* or ?)
search_mode Search direction No 1 first‑to‑last (default)
-1 last‑to‑first (useful for duplicates)

Key points

Google Sheets note: Sheets does not have a native XLOOKUP (as of 2024). You can mimic the behavior with INDEX + MATCH or the newer LOOKUP functions.


Setting Up a Simple Lookup Example

1. Build the sample table

A (Product ID) B (Product Name) C (Price)
101 Widget A $12.99
102 Widget B $15.49
103 Widget C $9.75
104 Widget D $13.30

Place the table in A2:C5 and give it the name Products (select the range and type Products in the Name Box).

2. Write the XLOOKUP formula

Assume E2 is where you type a Product ID and E3 should show the price:

=XLOOKUP(E2, Products[Product ID], Products[Price], "Not found")

In Google Sheets you must reference the ranges directly, e.g. =XLOOKUP(E2, A2:A5, C2:C5, "Not found").

3. Test it

E (Lookup ID) F (Result)
103 $9.75
105 Not found

When E2 contains 103, the formula returns $9.75. If you type 105, the custom “Not found” message appears instead of an error.

4. Why XLOOKUP beats older functions


Exact vs. Approximate Matches

XLOOKUP defaults to an exact match (match_mode = 0). Change the match_mode argument for approximate lookups.

Exact match (most common)

=XLOOKUP(A2, Products[Product ID], Products[Price], "Not found")

If A2 = 102, the result is $15.49; otherwise “Not found”.

Approximate match – “next smaller”

Useful for tiered tables (e.g., discounts). Set match_mode to ‑1 to return the largest lookup value that is ≤ the searched value.

=XLOOKUP(B2, Qty[MinQty], Qty[Discount%], 0, -1)
MinQty Discount%
1 0%
10 5%
25 10%
50 15%

If B2 = 32, the formula returns 10% (the discount for the 25‑unit tier).


Advanced XLOOKUP Techniques

1. Multiple criteria

Create a helper array that concatenates the criteria, then look up that array.

A (Region) B (Product) C (Sales)
East Widget 1200
West Gadget 950
East Gadget 800
West Widget 1100

Goal: Sales for West + Widget.

=XLOOKUP("West"&"Widget", A2:A5&B2:B5, C2:C5, "Not found")

Result: 1100.
Tip: Wrap each part with TEXT(...,"@") if any column may contain blanks.

2. Returning multiple columns (array result)

XLOOKUP can spill a whole row or column range.

A (Employee) B (Dept) C (Salary) D (HireDate)
Alice Finance 72000 01‑03‑2019
Bob IT 68000 15‑07‑2020
Carol HR 65000 22‑11‑2018

Goal: Get Salary and HireDate for Bob.

=XLOOKUP("Bob", A2:A4, C2:D4)

Spills into two adjacent cells:

68000 15‑07‑2020

In Google Sheets the same syntax works once dynamic arrays are enabled.


FAQ

What versions of Excel support XLOOKUP?

XLOOKUP is available in Excel 365 (subscription) and Excel 2021 (or later). It does not exist in Excel 2019 or earlier versions.

How does XLOOKUP differ from VLOOKUP and HLOOKUP?

XLOOKUP lets you search in any direction, return values from any column or row, and includes optional error handling and match‑mode arguments. VLOOKUP/HLOOKUP can only search forward (down or right) and require a column index number, plus a separate wrapper for error handling.

Can XLOOKUP be used in Google Sheets?

Google Sheets does not have a native XLOOKUP function (as of 2024). You can achieve similar results with INDEX + MATCH, FILTER, or the newer LOOKUP functions. The syntax shown above works only in Excel.

What if XLOOKUP returns #N/A?

#N/A appears when the lookup value isn’t found and you haven’t supplied the optional if_not_found argument. Add a fourth argument, e.g. "Not found" or 0, to replace the error with a custom result.

How to handle errors in XLOOKUP results?

Use the if_not_found argument for simple cases. For more complex handling (e.g., logging or alternative calculations), wrap XLOOKUP in IFERROR or IFNA:

=IFERROR(
    XLOOKUP(E2, Products[Product ID], Products[Price]),
    "Check ID"
)

This returns “Check ID” if any error (including #N/A or #VALUE!) occurs.


All formulas shown are fully functional in the indicated Excel versions. Adjust range references as needed for your own worksheets.