Google Sheets XLOOKUP: A Practical Guide for Lookups

Master Google Sheets XLOOKUP with practical syntax and examples. Learn to replace VLOOKUP and INDEX/MATCH for fast, reliable lookups in data-heavy sheets.

How To Sheets
How To Sheets Team
·5 min read
Quick AnswerDefinition

XLOOKUP in Google Sheets is a modern lookup function that replaces older methods like VLOOKUP and INDEX/MATCH with a simpler syntax and more flexibility. It searches a vertical range for a match and returns a corresponding value from a parallel range, with clear handling for missing data and errors. Designed for horizontal and vertical lookups, XLOOKUP supports a custom not-found value, approximate matches, and reverse search.

What is google sheets xlookup and why it matters

XLOOKUP in Google Sheets is a modern lookup function that consolidates and simplifies older lookup approaches. It makes your spreadsheets easier to read and maintain, while reducing the need for nested formulas. This is especially valuable for datasets with multiple related fields across columns. In this guide, you’ll see practical, copy-paste-ready examples that you can adapt to your work.

Excel Formula
=XLOOKUP(A2, Customers!A2:A100, Customers!B2:B100, "Not found", 0, 1)

This example searches for the value in A2 within the Customer IDs (A2:A100) and returns the corresponding Name from column B (B2:B100). If the search key is not present, the function returns the text Not found.

Syntax and parameters

XLOOKUP takes six arguments, with the first three required in most cases:

  • search_key: The value you want to locate (e.g., A2).
  • lookup_range: The vertical array where you search for the key (e.g., A2:A100).
  • return_range: The corresponding array from which to pull the result (e.g., B2:B100).
  • missing_value (optional): What to show if there is no match (e.g., "Not found").
  • match_mode (optional): 0 for exact, -1 for exact or next smaller, 1 for exact or next larger.
  • search_mode (optional): 1 to search from first to last (default), -1 to search from last to first.
Excel Formula
=XLOOKUP(A2, A2:A100, B2:B100, "Not found", 0, 1)

This formula performs an exact match (0) and returns the first matching item from B2:B100. If no match exists, it returns Not found. You can switch to reverse search (-1) or approximate matches (1) as needed.

Practical example: exact lookup with missing value handling

Let's look up an employee name by their ID, returning a friendly message if not found:

Excel Formula
=XLOOKUP(E4, Staff!$A$2:$A$500, Staff!$B$2:$B$500, "Employee not found", 0, 1)

This example demonstrates a typical use case: you have an ID in cell E4, and you want the corresponding Name from the Staff table. If the ID isn’t in the table, you’ll see the string Employee not found. This keeps dashboards clean and prevents #N/A from propagating.

Advanced variations: using CHOOSE for multi-field lookups

If you need to pull multiple fields at once, wrap XLOOKUP with CHOOSE to return multiple columns:

Excel Formula
=CHOOSE({1,2}, XLOOKUP(A2, Inventory!$A$2:$A$100, Inventory!$B$2:$B$100, "Not found"), XLOOKUP(A2, Inventory!$A$2:$A$100, Inventory!$C$2:$C$100, "Not found"))

This returns two adjacent columns (e.g., Price and Stock) for the found item, enabling a compact, multi-field lookup without nested formulas.

Handling not-found values and errors

XLOOKUP supports a dedicated not-found value to improve UX. You can also wrap the function with IFERROR to catch any unexpected errors and present a clean message, which is especially useful in dashboards shared with non-technical users.

Excel Formula
=IFERROR(XLOOKUP(D2, Products!$A$2:$A$100, Products!$B$2:$B$100, "N/A"), "Lookup failed")

This approach ensures a friendly fallback for both missing data and potential runtime hiccups in large sheets.

Cross-sheet lookups and named ranges

XLOOKUP works across sheets and with named ranges, which makes your formulas portable and readable. Suppose you defined a named range Products_Code for A2:A100 and Products_Price for B2:B100 on a different sheet; you can reference them directly:

Excel Formula
=XLOOKUP(D2, Products_Code, Products_Price, "Not found", 0, 1)

Using named ranges reduces maintenance risk when column orders change, and it keeps formulas shorter and clearer on dashboards.

Common pitfalls and debugging tips

  • Ensure the lookup and return ranges have the same length; otherwise XLOOKUP may return unexpected results.
  • Avoid mixing relative and absolute references haphazardly; use $ anchors for ranges you copy across rows.
  • If your data contains leading/trailing spaces, trim them or apply CLEAN to normalize values before indexing.
  • When working with large datasets, prefer defined ranges over entire columns to improve calculation performance.
Excel Formula
=XLOOKUP(TRIM(E2), TRIM(Inventory!$A$2:$A$100), Inventory!$B$2:$B$100, "Not found", 0, 1)

Performance tips and best practices

For very large sheets, consider the following to keep lookups fast:

  • Limit lookup and return ranges to the actual data window (e.g., A2:A1000).
  • Use exact match mode (0) to reduce unnecessary comparisons.
  • Cache common lookups in helper columns if the dataset is static or changes slowly.
  • Prefer named ranges to simplify audits and reduce copy-paste errors.
Excel Formula
=LET(k, E2, XLOOKUP(k, Inventory_Code, Inventory_Price, "Not found"))

Note: LET is supported in Google Sheets to some extent via functions that memoize results; adjust with your environment's capabilities.

Real-world use case: inventory management

Imagine you manage an inventory sheet with ItemCode in column A, Description in B, and Price in C. You want to fetch Description and Price for a given ItemCode in D2. The following approach retrieves both fields in one go using CHOOSE and XLOOKUP:

Excel Formula
=CHOOSE({1,2}, XLOOKUP(D2, Inventory!$A$2:$A$100, Inventory!$B$2:$B$100, "Not found"), XLOOKUP(D2, Inventory!$A$2:$A$100, Inventory!$C$2:$C$100, "Not found"))

This yields two adjacent columns: Description and Price, enabling compact dashboards and quick-response queries.

Advanced patterns: dynamic references and named ranges

As your data scales, using named ranges can help readability and maintenance. Define a code table named Inventory_Code for A2:A100 and corresponding ranges for Description and Price. Then, use:

Excel Formula
=XLOOKUP(D2, Inventory_Code, Inventory_Description, "Not found", 0, 1)

If you need cross-sheet lookups, point both ranges to sheet-scoped names like 'Inventory Desc'!$B$2:$B$100 and 'Inventory Code'!$A$2:$A$100. This makes formulas robust to column reordering and sheet reorganizations.

Quick recap and next steps

  • XLOOKUP provides a cleaner and more flexible alternative to older lookups in Google Sheets.
  • Start with exact matching and a sensible not-found value to keep dashboards informative.
  • Use CHOOSE for multi-field lookups and named ranges for maintainability.
  • Always test edge cases (missing data, duplicates, and empty cells) before deploying in production sheets.

Steps

Estimated time: 25-40 minutes

  1. 1

    Open your sheet and locate the lookup data

    Identify the key column (lookup_range) and the column with the return values (return_range). Ensure both ranges are the same length and properly aligned to prevent misaligned results.

    Tip: Keep data in a single table or define a named range for easy reuse.
  2. 2

    Write the base XLOOKUP formula

    Place the formula in the target cell and reference the key cell. Start with an exact match to verify the basic behavior.

    Tip: Use a simple dataset first to confirm expected results.
  3. 3

    Add a not-found fallback

    Utilize the optional [missing_value] parameter to provide a friendly message when there’s no match.

    Tip: Choose a message that won’t be mistaken for actual data.
  4. 4

    Test with edge cases

    Try values that don’t exist, empty cells, and duplicates to understand how XLOOKUP responds under pressure.

    Tip: Document any surprising results for future reference.
  5. 5

    Extend to other fields

    If you need multiple fields, use CHOOSE or nest multiple XLOOKUP calls to fetch each column.

    Tip: Avoid overly large formulas; split into helper cells if needed.
  6. 6

    Validate and deploy

    Copy the formula to other rows and compare results with a trusted source to ensure accuracy.

    Tip: Automate a quick test with a small sample before scaling up.
Pro Tip: Prefer exact matching (0) unless you specifically need an approximate match.
Warning: Limit lookup and return ranges to data boundaries to improve performance on large sheets.
Note: For missing data, use a clear not-found value to prevent ambiguity in dashboards.
Pro Tip: Combine XLOOKUP with IFERROR for robust error handling in combined dashboards.

Prerequisites

Required

Optional

  • A sample dataset or template to practice on
    Optional

Keyboard Shortcuts

ActionShortcut
CopyCopy selected cells or formulasCtrl+C
PastePaste content into cellsCtrl+V
FindSearch within the sheetCtrl+F
Fill downCopy the formula down a columnCtrl+D
Edit active cellEdit the current cell contentsF2

FAQ

What is Google Sheets XLOOKUP and when should I use it?

XLOOKUP is a modern lookup function in Google Sheets that simplifies pulling related data across columns. Use it when you want a clean syntax and predictable handling for exact or approximate matches.

XLOOKUP is a modern lookup tool in Sheets that makes cross-column data retrieval simpler and more reliable.

Can XLOOKUP replace VLOOKUP and INDEX/MATCH completely?

In most cases, yes. XLOOKUP provides a simpler and more flexible alternative to VLOOKUP and INDEX/MATCH, reducing nesting and edge-case errors.

Yes, you can typically replace VLOOKUP and INDEX/MATCH with XLOOKUP for cleaner formulas.

How do I handle missing results in XLOOKUP?

Use the optional not-found value or wrap XLOOKUP in IFERROR to present a friendly fallback for missing data.

Use not-found values or IFERROR to handle missing results gracefully.

What about approximate matches and reverse searches?

XLOOKUP supports exact, approximate, and reverse search modes via match_mode and search_mode parameters. Use 0 for exact, 1 for approximate, -1 for reverse search.

XLOOKUP can do exact, approximate, and reverse searches depending on the options you set.

Are there performance considerations with large datasets?

Yes. Keep lookup ranges limited to the data you actually need, and consider helper columns for extremely large datasets to preserve sheet responsiveness.

Limit lookup ranges and consider helpers for very large datasets to keep performance high.

The Essentials

  • Use XLOOKUP for clean, flexible lookups in Sheets
  • Always provide a not-found value for clarity
  • Exact match (0) is safer with messy data
  • Leverage CHOOSE for multi-field results when needed

Related Articles