SheetRocks
Documentation/Formulas/XLOOKUP

XLOOKUP

Searches a range or array for a match and returns the corresponding item from a second range or array. Supports exact and approximate matching, wildcards, and reverse search.

Syntax

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

Arguments

Argument Description Required
lookup_value The value to search for Required
lookup_array The array or range to search in Required
return_array The array or range to return from Required
if_not_found Value to return if no match is found. Defaults to error. Optional
match_mode 0=exact match (default), -1=exact or next smaller, 1=exact or next larger, 2=wildcard Optional
search_mode 1=first to last (default), -1=last to first, 2=binary ascending, -2=binary descending Optional

Examples

Basic exact match lookup

=XLOOKUP("Banana", A1:A3, B1:B3)
Result ⇒ 0.99
A B
1 Apple 1.99
2 Banana 0.99
3 Cherry 2.99

Lookup with custom not found message

=XLOOKUP("Z", A1:A3, B1:B3, "Not Found")
Result ⇒ Not Found
A B
1 A Alpha
2 B Beta
3 C Charlie

Approximate match (next larger)

=XLOOKUP(25, A1:A3, B1:B3, , 1)
Result ⇒ Large
A B
1 10 Small
2 20 Medium
3 30 Large

Related Functions

Other Data functions:


← Back to Formula Reference