1. Home
  2. Functions
  3. Lookup and reference
  4. XLOOKUP

XLOOKUP function

Searches a range or array for a match and returns the matching item from a second range or array.

Syntax

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

Arguments

ArgumentRequiredDescription
lookup_valueRequiredThe value to look for
lookup_arrayRequiredThe row or column to search
return_arrayRequiredThe range or array to return from
if_not_foundOptionalWhat to return when nothing matches (default #N/A)
match_modeOptional0 exact (default), -1 exact or next smaller, 1 exact or next larger, 2 wildcard
search_modeOptional1 first to last (default), -1 last to first, 2 binary search ascending, -2 binary search descending

How to use XLOOKUP

XLOOKUP takes 3 required arguments and 3 optional arguments. Type =XLOOKUP( in a cell and SheetsBat shows the arguments as you go. Optional arguments are shown in square brackets; leave them out to use their default.

Examples

Each result below was calculated by the SheetsBat formula engine.

=XLOOKUP("b", {"a";"b";"c"}, {10;20;30})Result 20
=XLOOKUP("z", {"a";"b"}, {1;2}, "none")Result "none"
=XLOOKUP(25, {10;20;30}, {"x";"y";"z"}, , -1)Result "y"

Every formula, right in your browser

SheetsBat calculates 536 functions, with charts, pivot tables and live collaboration. Free to start.