Xlookup Function (16-7-23)
Xlookup Function (16-7-23)
5 [match_mode] =
0 - Exact Match = Default. "Quad" matches "Quad". "Quad " does NOT match "Quad". If no m
nothing in 4th argument, #N/A.
-1 - Exact Match or Next Smaller = Use for items like tax rates and commission rates. Values
be sorted.
1 - Exact Match or Next Bigger = Use for items like square footage. Values do not have to be
2 - Wildcards => * = zero or more characters, ? = single character. "Quad*" finds anything
with "Quad". "*?" finds any text.
6 [search_mode] =
1 - Search First to Last = Default. When there are duplicates, it gets FIRST ONE!
-1 - Search Last To First = When there are Duplicates, it gets LAST ONE!
2 - Binary search for Smallest To Biggest Sort = Column must be sorted. Like old VLOOKUP an
Approximate Match Lookup.
2 - Binary search for Biggest To Smallest Sort = Column must be sorted. Like old MATCH -1 A
Match Lookup.
5 6
[match_mode],[search_mode])
tem in return_array
same size.
nd in lookup_array
Match?
Retrieve
Lookup Table:
ProductID Product Cost Price
A25C-4884 Aspen 14.55 26.95
C20G-4398 Carlota 11.18 27.95
Q22G-9634 Quad 19.34 43.95
S35G-4382 Sunshine 11.25 22.95
Corresponding position
Y30C-4942 Yanaki 12.88 29.95
What is Lookup?
oduct range?
) Look in the
rice range to
nd the 3rd
rice
Formula in D5:
Old School 2:
First Last StartDate CellPhone Department
Kip Hensel 10/6/20 206-821-4452 Maintenance
Old School 2:
First Last StartDate CellPhone Department
Kip Hensel 10/6/20 206-821-4 Maintenance
Goal: Lookup earnings tax rate using "Exact match or next smaller lookup"
Weekly Earnings Tax Rate
$1,200 10.0%
Match?
Retrieve
Lookup Table:
Weekly Earnings
Range of Earnings Tax Rate
Lower Limit
$0 $0 - $299.99 0.0%
$300 $300 - $599.99 2.5%
$600 $600 - $999.99 7.0%
$1,000 $1,000 - $1,999.99 10.0%
$2,000 $2,000 - $4,999.99 position
Corresponding 15.0%
$5,000 $5,000 or more 20.0%
What is Lookup?
Goal: Lookup earnings tax rate using "Exact match or next smaller lookup"
1) Lookup the Weekly Earnings Tax Rate 5) Get tax rate of 10.0%
number 1200 $1,200 10.0% and bring it back to cell
Lookup Table:
Conditional Formatting Formulas:
Earnings Range TaxRate
$0 $0 - $299.99 0.0% ### #NAME? #NAME?
$300 $300 - $599.99 2.5% ### #NAME? #NAME?
$600 $600 - $999.99 7.0% ### #NAME? #NAME?
$1,000 $1,000 - $1,999.99 10.0% ### #NAME? #NAME?
$2,000 $2,000 - $4,999.99 15.0% ### #NAME? #NAME?
$5,000 $5,000 or more 20.0% ### #NAME? #NAME?
Err:509
Err:509
,D10:D15,0,-1)
,D10:D15,0,-1)
Goal: Lookup earnings tax rate using "Exact match or next smaller lookup"
Lookup Table:
Conditional Formatting Formulas:
Earnings Range TaxRate
$0 $0 - $299.99 0.0% ### #NAME? #NAME?
$300 $300 - $599.99 2.5% ### #NAME? #NAME?
$600 $600 - $999.99 7.0% ### #NAME? #NAME?
$1,000 $1,000 - $1,999.99 10.0% ### #NAME? #NAME?
$2,000 $2,000 - $4,999.99 15.0% ### #NAME? #NAME?
$5,000 $5,000 or more 20.0% ### #NAME? #NAME?
Err:509
Err:509
,D10:D15,0,-1)
Goal: XLOOKUP can use vertical or horizontal lookup tables.
Grade Tables Use: "Exact Match or Next Smaller" or "Approximate Match" Lookup
% Grade Letter Grade Letter Grade 0.0% 60.0% 70.0% 80.0% 90.0%
50.0% F % Grade F D C B A
60.0% D
70.0% C
80.0% B
90.0% A
F
0.0%
90.0%
A
Goal: Retrieve drain pipe size based on land square footage.
Old School 1:
Land Square Footage 23,000 Formula in C20:
Pipe Size Required 8'' =INDEX(C8:C14,MATCH(C19,B8:B14,-1))
Goal: Retrieve drain pipe size based on land square footage.
Old School 1:
Land Square Footage 23,000 Formula in C20:
Pipe Size Required 8'' =INDEX(C8:C14,MATCH(C19,B8:B14,-1))
Goal: Lookup Coca Cola and get a match for Coca Cola Inc.
Example of: Wildcard lookup (synonyms: partial text lookup, fuzzy lookup)
Company (partial
text) City Formula in C6:
Coca
Lookup Table:
Company
(full text) City
Coca Cola Inc. Atlanta
Pepsi Cola Inc. NY
RC Cola KC
Shasta Drinks Calistoga
Old School 1:
Company
(partial text) City
Coca Cola Atlanta
Formula in N6:
=VLOOKUP("*"&M6&"*",B11:C14,2,0)
Text MECS Video #6 technique to extract all records that contain "Cola":
Formula in M16:
{=_xlfn._xlws.filter(B11:C14,ISNUMBER(SEARCH(K14,B11:B14)))}
* This is using FILTER as a lookup function to return multiple items from a single lookup value.
Goal: Lookup Coca Cola and get a match for Coca Cola Inc.
Example of: Wildcard lookup (synonyms: partial text lookup, fuzzy lookup)
Company (partial
text) City Formula in C6:
Coca Atlanta =_xlfn.xlookup("*"&B6&"*",B11:B14,C11:C14,,2)
Lookup Table:
Company
(full text) City
Coca Cola Inc. Atlanta
Pepsi Cola Inc. NY
RC Cola KC
Shasta Drinks Calistoga
Old School 1:
Company
(partial
text) City
Coca Cola Atlanta
Formula in N6:
=VLOOKUP("*"&M6&"*",B11:C14,2,0)
Text MECS Video #6 technique to extract all records that contain "Cola":
Company
(partial Company
text) (full text) City
Cola #NAME? #NAME?
#NAME? #NAME?
#NAME? #NAME?
Formula in M16:
{=_xlfn._xlws.filter(B11:C14,ISNUMBER(SEARCH(K14,B11:B14)))}
* This is using FILTER as a lookup function to return multiple items from a single lookup value.
Goal: Lookup first date worked on project.
"Get First" when there are duplicates = Exact Match Lookup does this by default.
First Date
Employee Worked ### ### ### ### ###
Chin x x x
Gigi x x
Sioux x x x
Chantel x x x x x
Billy x x
Formula in C8:
Old School 1:
10/6/2021
Err:509
First Date
Employee Worked ### ### ### ### ###
Chin #NAME? x x x
Gigi #NAME? x x
Sioux #NAME? x x x
Chantel #NAME? x x x x x
Billy #NAME? x x
First Date
Employee Worked ### ### ### ### ###
Chin 10/6/2021 x x x
Gigi #NAME? x x
Sioux #NAME? x x x
Chantel #NAME? x x x x x
Billy #NAME? x x
Formula in C8:
=_xlfn.xlookup("x",D8:H8,$D$7:$H$7,"Didn't work")
Enter and copy to rows below.
Old School 1:
10/6/2021
Err:509
First Date
Employee Worked ### ### ### ### ###
Chin #NAME? x x x
Gigi #NAME? x x
Sioux #NAME? x x x
Chantel #NAME? x x x x x
Billy #NAME? x x
If you have a way of marking the last, like with a unique dat
Sales Rep Last Sale Formula in G21:
Sioux #NAME? {=_xlfn.xlookup(MAXIFS(B6:B15,C6:C15,F21:F22)&F21:F22,B
Chin #NAME? Enter and it spills down to rows below.
Old School 1:
Sales Rep Last Sale Formula in G26:
Sioux 696.97 {=INDEX($D$6:$D$15,MATCH(MAX(IF($C$6:$C$15=F26,$B$6
Chin 765.99 Copy Down
Old School 2:
Sales Rep Last Sale Formula in G31:
Sioux 696.97 {=SUMIFS($D$6:$D$15,$B$6:$B$15,MAX(IF($C$6:$C$15=F31
Chin 765.99 Copy Down
and there are no duplicate matches for SalesRep and Date!!!
5,C6:C15,F21:F22)&F21:F22,B6:B15&C6:C15,D6:D15)}
MAX(IF($C$6:$C$15=F26,$B$6:$B$15))&F26,$B$6:$B$15&$C$6:$C$15,0))}
B$15,MAX(IF($C$6:$C$15=F31,$B$6:$B$15)),$C$6:$C$15,F31)}
Goals: 1) Lookup last sale for each sales rep, then 2) lookup up last date each Sales Rep made a sale.
"Get Last" when there are duplicates.
If Data Set Will NOT Be Sorted and there are no duplicate m
Date Sales Rep Sales Sales Rep Last Sale Formula in G6:
10/3/2021 Sioux $640.56 Sioux #NAME? {=_xlfn.xlookup(F6:F7,C6:C15,D6:D15,,,-1)}
10/3/2021 Chin $1,706.02 Chin #NAME? Enter and it spills down to rows below.
10/4/2021 Sioux $1,589.69
10/4/2021 Chin $695.31 If you know there are no duplicate sales for a given day:
10/5/2021 Sioux $474.26 Sales Rep Last Sale Formula in G11:
10/5/2021 Chin $786.13 Sioux 696.97 {=SUMIFS(D6:D15,B6:B15,MAXIFS(B6:B15,C6:C15,F11:F12),
10/6/2021 Sioux $811.12 Chin 765.99 Enter and it spills down to rows below.
10/6/2021 Chin $983.25
10/7/2021 Sioux $696.97
10/7/2021 Chin $765.99 Sales Rep Last Date Formula in G16:
Sioux ### {=MAXIFS(B6:B15,C6:C15,F16:F17)}
Chin ### Enter and it spills down to rows below.
Old School 1:
Sales Rep Last Sale Formula in G26:
Sioux 696.97 {=INDEX($D$6:$D$15,MATCH(MAX(IF($C$6:$C$15=F26,$B$
Chin 765.99 Copy Down
Old School 2:
Sales Rep Last Sale Formula in G31:
Sioux 696.97 {=SUMIFS($D$6:$D$15,$B$6:$B$15,MAX(IF($C$6:$C$15=F3
Chin 765.99 Copy Down
and there are no duplicate matches for SalesRep and Date!!!
6:D15,,,-1)}
IFS(B6:B15,C6:C15,F11:F12),C6:C15,F11:F12)}
5,C6:C15,F21:F22)&F21:F22,B6:B15&C6:C15,D6:D15)}
MAX(IF($C$6:$C$15=F26,$B$6:$B$15))&F26,$B$6:$B$15&$C$6:$C$15,0))}
B$15,MAX(IF($C$6:$C$15=F31,$B$6:$B$15)),$C$6:$C$15,F31)}