XLOOKUP in Excel is your powerful tool to search for and return values directly from a table—no VLOOKUP or INDEX-MATCH needed. It handles missing values better, works left-to-right, and supports text, numbers, and logical data. First, ensure you have a modern Excel version (Excel 2016 or later) as XLOOKUP is not available in earlier versions. If you’re using a cloud-based Excel Online, XLOOKUP works too, but only with data in a table format.

What You'll Need

  • A spreadsheet with data structured in columns (at least one column where you want to search)
  • Excel 2016 or newer (or Excel Online with table formatting)
  • Knowledge of basic Excel functions like LOOKUP or VLOOKUP (optional, for comparison)

Step-by-Step

  1. Start with a table: Arrange your data in a table format. For example, if you’re searching for employee names and their departments, place the names in Column A and departments in Column B. In Excel, select your data and go to Insert > Table (this creates a named range). If you’re using Excel Online, tables are automatically recognised.
  2. Enter the XLOOKUP formula: In a blank cell where you want the result, type this basic formula: XLOOKUP(lookup_value, lookup_array, return_value, [if_not_found], [match_mode], [search_mode]) Example: In cell D2 (assuming your table starts at A1), type: =XLOOKUP(A2, A1:B10, B1:B10) This searches Column A for the value in A2 and returns the corresponding value from Column B. Breakdown of parts:
    • lookup_value: The item you’re searching for (e.g., "John").
    • lookup_array: The array you’re searching within (e.g., A1:B10 for all rows in Column A).
    • return_value: The array to return values from (e.g., B1:B10 for all rows in Column B).
    • [if_not_found]: Optional. If omitted, Excel returns #N/A. Add a default value like "" (empty) or "N/A".
    • [match_mode]: Optional. Use 0 for approximate matches (e.g., "Jo" would match "John") or 1 for exact matches.
    • [search_mode]: Optional. Use 0 for left-to-right search (default) or 1 for right-to-left.
  3. Test with real data: Enter a value in A2 (e.g., "John") and check if the result in D2 matches the corresponding department in B2. For example, if "John" is in row 3, D2 should show the department from row 3 of Column B.
  4. Automate with helper columns: For complex searches, create a helper column with the lookup values. For example, if you need to search across multiple columns, use: =XLOOKUP(A2, A1:C100, B1:C100, "N/A") This returns the value from B if found in A, otherwise returns "N/A" from C.

Common Mistakes

  • Forgetting table formatting: Without a table (Insert > Table), ensure your data is contiguous, with no gaps. If your data is not in a table, use relative references (e.g., $A$1:$B$10) to avoid errors from dragging formulas.
  • Using older Excel versions: XLOOKUP is not available in Excel 2013 or earlier. Upgrade or use a compatible version.
  • Incorrect lookup_value: Ensure the lookup_value matches exactly (case-sensitive for text). For case-insensitive search, add 0 for [match_mode].
  • Missing return_value: If you omit return_value, Excel returns #N/A. Always include it to avoid errors.
  • Array references with errors: If your array references are incorrect (e.g., missing rows), drag the formula carefully. Use absolute references (e.g., $A$1:$B$10) if the table size varies.

Tips

  • Use wildcards for partial matches: For fuzzy searches, set [match_mode] to 0. For example, XLOOKUP("Jo*", A1:A100, B1:B100) finds "John" or "Jones."
  • Combine with IFERROR: To handle errors gracefully, wrap XLOOKUP in IFERROR: =IFERROR(XLOOKUP(A2, A1:B100, B1:B100, "N/A"), "Data not found")
  • Leverage table headers: If your table has headers, use absolute references with headers in place of rows: =XLOOKUP(A2, $A$1:$B$100, $B$1:$B$100)
  • Compare with VLOOKUP: XLOOKUP is more flexible. VLOOKUP requires a column index and may return incorrect results if the lookup value isn’t in the first column. Use XLOOKUP(lookup_value, lookup_array, return_column, "N/A") as a drop-in replacement for VLOOKUP.
  • Sort data first: If your data is unsorted, sort it alphabetically or numerically before using XLOOKUP for consistent results.

Troubleshooting

  1. #N/A error:
    • The lookup_value doesn’t exist in the lookup_array.
    • The return_value is empty or invalid.
    • Check for typos in the lookup_value or data.
    • Set [if_not_found] to a default value (e.g., "N/A").
    Fix: Verify the lookup_value matches exactly. Add an IFERROR wrapper or adjust [if_not_found].
  2. #VALUE! error:
    • The lookup_array or return_value contains non-numeric/text data.
    • The lookup_value is not in the correct format (e.g., text vs. numbers).
    Fix: Ensure all values in the arrays are consistent (same type: text vs. numbers). Use TEXT or NUMBER functions if needed.
  3. Formula not updating:
    • The table isn’t set up properly (e.g., extra rows/columns).
    • Drag the formula with absolute references (e.g., $A$1:$B$100) to avoid errors.
    Fix: Double-check table formatting. Use absolute references or drag formulas carefully.
  4. Performance slowdown:
    • The lookup_array is too large (e.g., millions of rows).
    • XLOOKUP is written to Excel’s VBA (slower than native functions).
    Fix: Break the lookup into smaller arrays. For large datasets, consider filtering data first or using Power Query.

Frequently Asked Questions

How do I use XLOOKUP in Excel Online?

XLOOKUP works in Excel Online if your data is in a table. Create a table (e.g., Insert > Table), then use the formula: =XLOOKUP(lookup_value, lookup_array, return_value, "N/A") Ensure your data is contiguous and named correctly. For example, if your table is named "Employees" and data spans rows 1–100, use: (Replace "Employees" with your table name.)

Can I use XLOOKUP with arrays or dynamic ranges?

Yes, but avoid errors by using absolute references. For example, if your data is in sheets with inconsistent row counts, use: =XLOOKUP(A2, $A$1:$Z$100, $B$1:$Y$100) This ensures the formula references the same range regardless of sheet size.

Why does XLOOKUP return "N/A" for every entry?

This happens if: 1. The lookup_value is not found in the lookup_array. 2. The lookup_array is empty or invalid. 3. The return_value is incorrect or empty. Fix: Verify the lookup_value matches data in the array. Check for blank rows or typos. Use IFERROR to handle cases where data might not exist.

How does XLOOKUP compare to INDEX-MATCH?

XLOOKUP is more intuitive for simple searches because it directly returns values. INDEX-MATCH requires manual setup (e.g., INDEX(B:B, MATCH(A2, A:A, 0))) and is error-prone if the lookup_column isn’t first. XLOOKUP handles left-to-right searches and wildcards better. Use INDEX-MATCH only for complex multi-column lookups.

What if my data has mixed case (e.g., "John" vs. "john")?

Set [match_mode] to 0 for approximate matches, or use TEXTJOIN with UPPER/LOWER functions: =XLOOKUP(UPPER(A2), UPPER(A1:A100), UPPER(B1:B100), "N/A") This forces case-insensitive matching.

Can I use XLOOKUP with dates?

Yes, XLOOKUP works with dates as long as they’re in the correct format (e.g., 1/1/2023 or "01-Jan-2023"). For example: =XLOOKUP("2023", A1:A100, B1:B100, "N/A") This searches for the year 2023 in Column A and returns the corresponding value from Column B.