Tests the search_table for the given lookup_value and returns a corresponding value from the result_table. XLOOKUP is an advanced version of the VLOOKUP and HLOOKUP functions that searches both vertically and horizontally.
Syntax
lookup_value: The value to search for in the search_table. Eg., F3
search_table: Range with values to evaluate. Eg., C2:C13
result_table: Range that you want the corresponding value from as result. Eg., A2:B13
if_not_found: Text to be displayed when no valid match is found. Defaults to #N/A error if omitted. Eg., "Invalid Emp ID"
match_mode: Determines the type of match to perform. Defaults to 0, if omitted.
Supported match_mode:
0 - The first exact match is considered.
-1 - The first exact match is considered. If none found, it returns the next smallest value.
1 - The first exact match is considered. If none found, it returns the next largest value.
2 - A regex match where .*, .?, and / have special meaning.
search_mode: Determines how lookup_value is searched in search_table. . Defaults to 1, if omitted.
Supported search_value:
1 - Search from top to bottom in the given range.
-1 - Search from bottom to top in the given range.
2 - Perform a binary search with the search_table sorted in ascending order. If not sorted, invalid results will be returned.
Remarks
XLOOKUP can be used to bring corresponding data from other worksheets.
Use named ranges for
search_table
and
result_table
. This helps refer a single source data table to create multiple tables for calculation and analysis.
If you don't remember the complete text you have to search for, use
.*, .?
and
/
instead.
.* - Can be used to replace any number of characters. Eg.,
Zyl.*
finds
Zylker
.? - Can be used to replace a single character. Eg.,
Mar.?us
finds
Marcus
and
Markus
/ - Can be used to include *, ? and / in the search term. Eg.,
Zylker/*
finds
Zylker*
and
Mar.?us/?
finds
Marcus?
and
Markus?
Examples
|
Formula
|
Result
|
|
=XLOOKUP(F3;C2:C13;A2:B13;"Invalid Emp Id")
|
Sarah Jones | 9/14/95
|
|
=XLOOKUP("Ben.*";A2:A13;C2:C13;"No result found";2)
|
4323
|
|
=XLOOKUP(I2;M$2:M$10;N$2:N$10)
|
Groceries
|
Possible Errors
|
Errors
|
Meaning
|
|
#N/A!
|
|
|
#NAME!
|
|
|
#VALUE!
|
|
|
#REF!
|
|
Similar Functions