Using XLOOKUP in Excel: a practical, step-by-step guide

Using XLOOKUP in Excel: a practical, step-by-step guide

XLOOKUP finds a value in one range and returns a corresponding value from another range using =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]). Use the worked example and checklist in this article to build, test, and troubleshoot your own XLOOKUP formulas.

What XLOOKUP does and the core syntax

XLOOKUP replaces many older lookup patterns by allowing a lookup range and a separate return range, optional custom not-found text, and flexible matching and search order. The full syntax is:

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

Quick reference for match_mode and search_mode

Step-by-step worked example

Below is a concise step-by-step example that shows how to write a formula, test it, and adapt it to a cross-sheet lookup.

  1. Prepare the data. On Sheet1 have a table: column A SKU, column B Quantity. On Sheet2 have SKU in column A and Price in column B.
  2. Identify the goal. Suppose on Sheet1 you want to pull Price from Sheet2 next to each SKU on Sheet1.
  3. Write the basic formula on Sheet1 cell C2 (next to the first SKU):
    =XLOOKUP(A2, Sheet2!A:A, Sheet2!B:B)
    This finds the SKU in Sheet2 column A and returns the corresponding Price from column B.
  4. Handle missing SKUs. Add an if_not_found value to avoid #N/A:
    =XLOOKUP(A2, Sheet2!A:A, Sheet2!B:B, "Price not found")
  5. Lock ranges for copying. If you will fill the formula down, use full column references or anchored ranges:
    =XLOOKUP(A2, Sheet2!$A:$A
    000, Sheet2!$B:$B
    000, "Price not found")
  6. Test exact vs approximate. If SKUs are text use exact match (default). For numeric nearest-match use match_mode 1 or -1 and ensure the lookup_array is sorted appropriately:
    =XLOOKUP(B2, Rates!$A:$A$500, Rates!$B:$B$500, "No rate", 1)
  7. Copy the formula down. Verify a handful of rows manually to confirm results, especially boundary conditions like first and last entries.

Exact vs approximate match: when to use each

Choose match_mode based on the data and desired behavior:

When using binary search options (search_mode 2 or -2), the lookup_array must be sorted to guarantee correct results; otherwise rely on the default first-to-last search.

Error handling: practical options

Two common ways to keep formulas user-friendly are the if_not_found argument and wrapping XLOOKUP with IFERROR. The if_not_found argument lets the formula return a custom message without producing an error. For example:

=XLOOKUP(E2, Products!A:A, Products!C:C, "Not listed")

If you prefer a broader trap that covers other runtime errors, wrap the lookup with IFERROR. See the detailed guidance in Handle Lookup Errors. Example:

=IFERROR(XLOOKUP(E2, Products!A:A, Products!C:C), "Lookup failed")

Common mistakes and quick fixes

These are frequent issues users encounter and how to fix them.

Practical checklist before you finalize

If you are transitioning from older lookup functions, the linked guide on How VLOOKUP Works explains when XLOOKUP is a direct replacement and when alternatives still make sense. For multi-condition lookups, see Advanced Lookups for patterns and examples.

Summary and next steps

XLOOKUP simplifies many common lookup scenarios by separating the lookup range from the return range and by adding built-in not-found handling and flexible matching. Start by building a single working formula, add if_not_found or IFERROR to handle missing values gracefully, and copy it down with anchored ranges. Use the checklist above to avoid common pitfalls and test a few edge cases before rolling the formula into production.

Follow the worked example, keep a short test dataset handy, and the function will become a reliable tool in your spreadsheet workflow.