Xlookup with multiple conditions

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the below table and what I need is below:

When I choose any team from the dropdown list, I will get the top 3 highest and lowest score for the selected team, then sort the results from lowest to highest for lowest score and highest to lowest for the highest score. I put the desired results table as an example when I select team 1 what should be the result. Can anyone help?

Xlookup Help with multi criteria.xlsx
ABCDEFGHIJKLMNOPQ
1Desired Result Table
2Team 1Team 2Team 3Team 4Team 5Team 6Team 7Team 8Team 9Team 10Team 1
3Category 140354043474646525255
4Category 235254041464746504846Category NameScore
5Category 340443748434347515057Lowest 3 ScoreCategory 235
6Category 441253734444239514954Category 140
7Category 545464750555352576062Category 1040
8Category 652575255585859576361Category 340
9Category 746484947525451546050Category 441
10Category 858655462646266596671Category 1341
11Category 947525053545654556266
12Category 1040444651514843515657Highest 3 ScoreCategory 652
13Category 1155635361546470587379Category 1155
14Category 1250575256586156596571Category 858
15Category 1341444743525145525357
16Category 1448605555616166657477
17
18
Sheet1
Cells with Data Validation
CellAllowCriteria
O2List=$B$2:$K$2
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Here's an option.
Book1
NOP
1Desired Result Table
2Team 1
3
4Category NameScore
5Lowest 3 ScoreCategory 235
6Category 140
7Category 340
8Category 1040
9Category 441
10Category 1341
11
12Highest 3 ScoreCategory 652
13Category 1155
14Category 858
Sheet5
Cell Formulas
RangeFormula
O5:P10O5=LET( f,FILTER(B3:K16,B2:K2=O2), h,HSTACK(A3:A16,f), SORT(FILTER(h,CHOOSECOLS(h,2)<=CHOOSEROWS(SORT(UNIQUE(f)),3)),2))
O12:P14O12=LET( f,FILTER(B3:K16,B2:K2=O2), h,HSTACK(A3:A16,f), SORT(FILTER(h,CHOOSECOLS(h,2)>=CHOOSEROWS(SORT(UNIQUE(f),,-1),3)),2))
Dynamic array formulas.
 
Upvote 0
Here's an option.
Book1
NOP
1Desired Result Table
2Team 1
3
4Category NameScore
5Lowest 3 ScoreCategory 235
6Category 140
7Category 340
8Category 1040
9Category 441
10Category 1341
11
12Highest 3 ScoreCategory 652
13Category 1155
14Category 858
Sheet5
Cell Formulas
RangeFormula
O5:P10O5=LET( f,FILTER(B3:K16,B2:K2=O2), h,HSTACK(A3:A16,f), SORT(FILTER(h,CHOOSECOLS(h,2)<=CHOOSEROWS(SORT(UNIQUE(f)),3)),2))
O12:P14O12=LET( f,FILTER(B3:K16,B2:K2=O2), h,HSTACK(A3:A16,f), SORT(FILTER(h,CHOOSECOLS(h,2)>=CHOOSEROWS(SORT(UNIQUE(f),,-1),3)),2))
Dynamic array formulas.
Amazing solution, thanks for this great formula.
How about if I need to get the lowest and highest sub category within a selected team and category? I put an example of desired result:

Xlookup Help with multi criteria.xlsx
ABCDEFGHIJKLMNOPQRST
1Desired Result TableCategory Name
2Team 1Team 2Team 3Team 4Team 5Team 6Team 7Team 8Team 9Team 10Team 1Category 1
3Category 140354043474646525255Category 2
4a35254041464746504846Category NameScoreCategory 3
5b40443748434347515057Lowest 3 ScoreCategory 235Category 4
6c41253734444239514954Category 140Category 5
7d45464750555352576062Category 1040Category 6
8Category 252575255585859576361Category 340Category 7
9e46484947525451546050Category 441Category 8
10f58655462646266596671Category 1341Category 9
11Category 347525053545654556266Category 10
12g40444651514843515657Highest 3 ScoreCategory 652Category 11
13h55635361546470587379Category 1155Category 12
14i50575256586156596571Category 858Category 13
15j41444743525145525357Category 14
16Category 448605555616166657477
17k43695147605762566962
18l39605559636053667162Team 1Lowest score sub categoryHighest score sub category
19Category 555545859596569647392Category 13545
20m34424842535861697677
21n70756267706485737992
22Category 654545861606365656576
23o40404549465353445264
24p45405253545651625779
25Category 741465547546466646364
26q63636272666368706886
27r41444743525145525357
28s48605555616166657477
29Category 839384652575545496043
30t50384451514748455350
31u43404351575152535771
32Category 957435556636064596679
33y48465053565450515985
34x57626365657170747475
35w50575757646776737864
36z41464850546156626679
37Category 1062626772677263726971
38a175857983758284888386
39a235425345556359626660
40a335294637475357586243
41a434465743547160667479
42Category 1130485561677067657054
43b139525548576760637071
44b237445342566059626454
45b334335238515949605757
46Category 1272737179717379797985
47c160536070616162696669
48c270766878697178787585
49c375786981707280788285
50Category 1374757377737885838585
51d1848484908385898989100
52d282908286828080878393
53Category 1482908085817872868193
54e182908087797684848186
55e282908487838476888693
56e379858185838081888093
57e4869285888684888889100
58
Sheet1
Cells with Data Validation
CellAllowCriteria
O2List=$B$2:$K$2
 
Upvote 0
You've changed your data a bit. Are you looking for the top or bottom part or both?
In the bottom, are you looking for: given a Category and Team what's the highest/lowest within sub-categories within that category?
 
Upvote 0
You've changed your data a bit. Are you looking for the top or bottom part or both?
In the bottom, are you looking for: given a Category and Team what's the highest/lowest within sub-categories within that category?
Yes, I added further details which is the sub category.
To answer your question: yes, I'm looking for a given category and team (highest and bottom) but not the top 3 or bottom 3, only one.
 
Upvote 0
Are the headers a literal "Category 1,2,3,..." or they're named something different? If they're named something different, how can you tell which lines are the categories and which are the sub-categories?
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,154
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top