XLOOKUP Function

XLOOKUP Function

XLOOKUP Function

Look up a value in one range and return a corresponding value from another range. XLOOKUP is a flexible modern replacement for many VLOOKUP, HLOOKUP, and INDEX/MATCH patterns.

ExcelClash Team
PUBLISHED

Summary

The Excel XLOOKUP function searches one range for a match and returns a corresponding value from another range. It is more flexible than VLOOKUP and HLOOKUP because the lookup range and return range are separate, so the return value does not have to be on one particular side of the table.

XLOOKUP is often used as a modern replacement for older lookup formulas. It supports exact match by default, has built-in handling for missing results, can search from the bottom of a list, and can return multiple columns at once.

Because of that flexibility, XLOOKUP is useful in both simple lookups and more advanced models where table structure may change over time.

Purpose

Flexible lookup and return

Finds a match in one range and returns a related value or record from another range.

Return Value

Matched result or custom fallback

Returns the matched value, a spilled record, or a custom if_not_found result.

Syntax

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

lookup_value is the item to find, lookup_array is where Excel searches for it, and return_array is what Excel returns when it finds a match. The remaining arguments let you control missing matches, match behavior, and search direction.

XLOOKUP uses exact match by default, which is one of the main differences from older lookup functions that often rely on approximate match unless you specify otherwise.

Arguments

  • lookup_value - The value to search for.
  • lookup_array - The range or array where the match should be found.
  • return_array - The range or array to return a result from.
  • if_not_found - [Optional] The result to return if no match exists.
  • match_mode - [Optional] 0 exact match, -1 exact or next smaller, 1 exact or next larger, 2 wildcard match.
  • search_mode - [Optional] 1 first-to-last, -1 last-to-first, 2 binary ascending, -2 binary descending.

The lookup array and return array should line up in size. If one has more rows or columns than the other, the result will not behave as intended.

XLOOKUP vs Other Functions

XLOOKUP overlaps with several older lookup functions, but its main advantage is flexibility.

Function Main Strength Use When
XLOOKUP Flexible lookup and return ranges You want a modern lookup function that can work in any direction
VLOOKUP Classic vertical lookup The workbook already uses a leftmost lookup table layout
HLOOKUP Classic horizontal lookup The lookup keys are stored across the top row
INDEX + MATCH Flexible lookup with separate position logic You need similar flexibility in workbooks that do not use XLOOKUP

In many modern workbooks, XLOOKUP can replace older lookup formulas with one function. In older or shared files, you may still see VLOOKUP, HLOOKUP, or INDEX with MATCH instead.

Using XLOOKUP

XLOOKUP is especially useful because it handles several common lookup problems directly. It can look to the left, return a custom message when no match exists, and search from the bottom of a list when the most recent match matters.

It is also useful for returning multiple columns in one step. If the return array includes several columns, the result can spill across adjacent cells and return the full matching record.

Wildcard matching is available too, but it is not automatic. If you want to use wildcards such as * or ?, set match_mode to 2.

  • Use XLOOKUP when the lookup direction or return shape may vary.
  • Use if_not_found to control missing matches without wrapping the formula in IFERROR.
  • Use search_mode=-1 when you need the last matching item instead of the first.

Example 1 - Standard Reverse Leftward Search

This formula looks up the name "Bob" in one range and returns the ID from a different range to its left. That is a pattern that older functions such as VLOOKUP cannot handle directly.

=XLOOKUP("Bob", B2:B5, A2:A5)
Check Answer
Challenge #1
Target: Sheet1!F1
Simple Forward Lookup

Find the score for "Alice" in A2:A5 and return the result from B2:B5. Formula: =XLOOKUP("Alice", A2:A5, B2:B5).

Example 2 - Built-in Error Resilience

Here the formula looks for a missing SKU and returns a custom message instead of an error. This is one of the most practical reasons many users prefer XLOOKUP over older lookup formulas.

=XLOOKUP("X-99", A2:A10, B2:B10, "Missing Item")
Check Answer
Challenge #2
Target: Sheet1!F2
Leftward (Reverse) Lookup

Find the ID associated with the name "Bob". Formula: =XLOOKUP("Bob", B2:B5, A2:A5).

Example 3 - Automated Latest Transaction Logic

With search_mode=-1, XLOOKUP searches from the bottom of the list upward. That means it returns the last matching occurrence rather than the first, which is useful in running logs or status histories.

=XLOOKUP("Update", B2:B100, C2:C100, , 0, -1)
Check Answer
Challenge #3
Target: Sheet1!F3
Built-in Error Handling

Find "Charlie"; if missing, return "Not Found". Formula: =XLOOKUP("Charlie", A2:A5, B2:B5, "Not Found").

Example 4 - Full Record Spill Retrieval

If the return array contains multiple columns, XLOOKUP can return the whole matching row in one formula. In modern Excel, that result spills into adjacent cells automatically.

=XLOOKUP(101, A2:A5, B2:D5)
Check Answer
Challenge #4
Target: Sheet1!F4
Latest Entry Recovery

Search for the last occurrence of "Sale" from bottom to top. Formula: =XLOOKUP("Sale", A1:A10, B1:B10, , 0, -1).

Conclusion Recap

  • Summary: XLOOKUP searches one range and returns a matching result from another range.
  • Syntax: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]).
  • Core setup: Keep the lookup and return arrays aligned and use the optional arguments deliberately.
  • Best use: Flexible lookups, left lookups, custom missing-result handling, and multi-column returns.
Tactical Arena
Select Scenario:
Share XLOOKUP Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.