Excel’s XLOOKUP function replaces older lookup methods like VLOOKUP with a more flexible, safer approach. It can return a value, error, or custom result, and works in ways that traditional functions can’t. You’ll need Excel 365 (or Excel 2019+, with some limitations) to use XLOOKUP fully. No additional tools or data types are required, but your data must be structured correctly for accurate results.

What You'll Need

  • An Excel spreadsheet (Excel 365, Excel 2021, or Excel 2019+ with recommended updates).
  • A dataset with at least two columns: one for search values (the "lookup" column) and one for the results (the "return" column).
  • Basic familiarity with Excel formulas (like how to reference cells or use ranges).

Step-by-Step

  1. Prepare your data:
    1. Arrange your data so the search values (e.g., product IDs, names) are in a column labeled, for example, "ID" or "Name."
    2. Place the corresponding results (e.g., prices, descriptions) in a separate column, labeled, for example, "Price" or "Details."
    Example: 101102103104105200A123A124
    IDNamePrice
    If you only have search values, add a third column for results (e.g., "Result Column")—this is optional for XLOOKUP but helps avoid errors.
  2. Write the XLOOKUP formula:
    1. In a blank cell, type: =XLOOKUP(search_value, lookup_column, return_column, "", [exact_match])
    2. Replace these placeholders:
      • search_value: The cell or range containing the value you’re looking up (e.g., D2 for a cell or A2:A5 for a range).
      • lookup_column: The column containing the exact values to search for (e.g., A2:A5).
      • return_column: The column with the results (e.g., B2:B5).
      • : A custom message (e.g., "Not found") to display if the value isn’t found. Optional: Add [exact_match] to force an exact match (e.g., TRUE for exact, FALSE or omit for approximate).
    Build the formula: =XLOOKUP(D2, A2:A5, B2:B5, "Not found", TRUE) This searches the "ID" column (A2:A5) for the value in D2 (e.g., 200) and returns the corresponding price from B2:B5. If 200 isn’t found, it shows "Not found."
  3. Test your formula:
    1. Enter the formula and check if the result matches your data.
    2. If the lookup value isn’t in the column, replace the search value in D2 with a value that exists (e.g., 101) to verify it works.

Common Mistakes

  1. Using the wrong column: Ensure the lookup_column contains the exact values you’re searching for. If your data includes headers (e.g., "Product Name"), use a range that skips rows (e.g., A3:A10).
  2. Omitting the error message: If you forget the fourth argument (e.g., , ""), Excel will return #N/A. Always add a placeholder text.
  3. Mixing case sensitivity: XLOOKUP is case-sensitive by default. To match "Apple" and "apple," add [exact_match]=TRUE (Excel 365+ only).
  4. Ignoring empty values: If your search value is blank, XLOOKUP returns "#N/A." To avoid this, ensure search cells have valid data.

Tips

  1. Use wildcards for partial matches: Combine XLOOKUP with Excel’s search functions (e.g., FIND() or TEXTBEFORE()) to extract parts of strings. Example: =TEXTBEFORE(XLOOKUP(D2, A2:A5, B2:B5, "----", TRUE), "---") This extracts the first 3 characters (e.g., "ABC" from "ABC123").
  2. Leverage multiple lookup columns: For complex datasets, use XLOOKUP in a nested formula. Example: =XLOOKUP(100, {"A100", "B200"}, {"Price1", "Price2"}, "Not found") Returns the correct price based on a dynamic lookup.
  3. Avoid circular references: If your formula references a cell containing another formula that loops back, Excel may produce errors. Test formulas in order (e.g., start with results that depend on search values).
  4. Backup your data: XLOOKUP doesn’t modify your data directly, but always save your workbook before testing complex formulas.

Troubleshooting

  1. Formula returns #N/A: Check these steps in order:
    1. Verify the search_value exists in the lookup_column. Try typing the exact value from the column.
    2. Ensure the lookup_column and return_column are correctly referenced (e.g., no extra spaces in the range).
    3. Add the error message argument (e.g., , "Not found").
    If still stuck: Test with a simple example: =XLOOKUP(1, A1:A3, B1:B3, "---") (Replace "1" with a value in A1:A3, e.g., 101.)
  2. Formula returns #VALUE! or #DIV/0!:
    1. Check for typos in the formula (e.g., missing commas).
    2. If the lookup_column or return_column contain errors (e.g., text where numbers are expected), Excel throws errors. Use ISNUMBER() to verify: =ISNUMBER(XLOOKUP(D2, A2:A5, B2:B5))
  3. Performance issues: For large datasets (e.g., 10,000+ rows), XLOOKUP can be slow. Optimize by:
    1. Using volatile functions (INDEX, MATCH) for small lookups.
    2. Filtering data before applying XLOOKUP to reduce search scope.
    3. Adding [search_type]=1 to speed up approximate matches (Excel 365+ only).

Frequently Asked Questions

How do I use XLOOKUP with text values?

XLOOKUP works with text (e.g., names, product codes) as long as the search value is an exact match. To ignore case sensitivity, use [exact_match]=TRUE (Excel 365+). For partial matches, omit [exact_match] or set it to FALSE.

Can I replace VLOOKUP with XLOOKUP?

Yes, but XLOOKUP is more flexible. Avoid VLOOKUP(..., FALSE) (approximate match)—XLOOKUP’s [exact_match] is clearer. If you need backward compatibility, XLOOKUP can emulate VLOOKUP by omitting the error message and using a default value (e.g., , 0).

What if my data has headers?

Skip headers in your ranges. Use ranges like A3:A10 instead of A2:A11. Alternatively, reference headers with INDEX() or OFFSET(), but this adds complexity.

Can XLOOKUP handle arrays or dynamic ranges?

No. XLOOKUP only supports single-cell references or static ranges. For dynamic ranges, use INDEX() or MATCH() alongside XLOOKUP, but this won’t replace XLOOKUP’s simplicity for most cases.

Is XLOOKUP available in older Excel versions?

XLOOKUP is not available in Excel 2016 or earlier. Upgrade to Excel 2019+ (or use the IFERROR() workaround for older versions).

How do I replace the error message with a value?

Use a helper column or IFERROR(). Example: =IFERROR(XLOOKUP(D2, A2:A5, B2:B5), 0) This returns 0 if the value isn’t found.