Top 3 and bottom 3 including Stubs

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
883
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team
I need top 3 and Bottom 3 incliuding stubs (DE,DF,DG,DH )

FS_Taiwan.xlsx
DEFGH
12Canada Goose37282627
13Moncler44272833
14Burberry31211623
15The North Face28232424
16Patagonia28212121
17Arc'teryx1591213
18Columbia41263132
19Duvetica31221919
20Mammut32181721
21Aigle24161115
22Herno24181918
23Moose Knuckles38271111
24Parajumpers281266
25Woolrich171588
Sheet1
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You need to include more information with your question. What's a "stub"? How do you determine the top 3? Bottom 3? Do you do it one column at a time, so you get 4 result columns, or are they combined somehow? What if there are ties (Aigle and Herno)? Can you present a mini-sheet where you have manually created the results you want to see?

If you have LET, here's one way to get the top 3/bottom 3 for the first column:

Book1
DEFGHIJK
12Canada Goose37282627Moncler44
13Moncler44272833Columbia41
14Burberry31211623Moose Knuckles38
15The North Face28232424Herno24
16Patagonia28212121Woolrich17
17Arc'teryx1591213Arc'teryx15
18Columbia41263132
19Duvetica31221919
20Mammut32181721
21Aigle24161115
22Herno24181918
23Moose Knuckles38271111
24Parajumpers281266
25Woolrich171588
Sheet4
Cell Formulas
RangeFormula
J12:K17J12=LET(a,SORT(D12:E25,2,-1),r,ROWS(a),s,SEQUENCE(r),FILTER(a,(s<=3)+(s>r-3)))
Dynamic array formulas.
 
Upvote 0
You need to include more information with your question. What's a "stub"? How do you determine the top 3? Bottom 3? Do you do it one column at a time, so you get 4 result columns, or are they combined somehow? What if there are ties (Aigle and Herno)? Can you present a mini-sheet where you have manually created the results you want to see?

If you have LET, here's one way to get the top 3/bottom 3 for the first column:

Book1
DEFGHIJK
12Canada Goose37282627Moncler44
13Moncler44272833Columbia41
14Burberry31211623Moose Knuckles38
15The North Face28232424Herno24
16Patagonia28212121Woolrich17
17Arc'teryx1591213Arc'teryx15
18Columbia41263132
19Duvetica31221919
20Mammut32181721
21Aigle24161115
22Herno24181918
23Moose Knuckles38271111
24Parajumpers281266
25Woolrich171588
Sheet4
Cell Formulas
RangeFormula
J12:K17J12=LET(a,SORT(D12:E25,2,-1),r,ROWS(a),s,SEQUENCE(r),FILTER(a,(s<=3)+(s>r-3)))
Dynamic array formulas.
Hi Eric,

Thanks so much Eric :)

Sorry for the inconvenience, I meant the stub says "Canada Goose" etc so i need top 3 and bottom 3 for all the columns including "Column A names"


Regards,
Sanjeev
 
Upvote 0
Here are a few options:

Book1
DEFGHIJKLMNOPQ
12Canada Goose37282627Moncler44Moncler44Moncler44
13Moncler44272833Columbia41Columbia41Columbia41
14Burberry31211623Moose Knuckles38Moose Knuckles38Moose Knuckles38
15The North Face28232424Herno24Aigle24Aigle24
16Patagonia28212121Woolrich17Herno24Woolrich17
17Arc'teryx1591213Arc'teryx15Woolrich17Arc'teryx15
18Columbia41263132Arc'teryx15
19Duvetica31221919
20Mammut32181721
21Aigle24161115
22Herno24181918
23Moose Knuckles38271111
24Parajumpers281266
25Woolrich171588
26
Sheet1
Cell Formulas
RangeFormula
J12:K17J12=LET(stub,D12:D25,value,E12:E25,a,SORT(CHOOSE({1,2},stub,value),2,-1),r,ROWS(a),s,SEQUENCE(r),FILTER(a,(s<=3)+(s>r-3)))
M12:N18M12=LET(stub,D12:D25,value,E12:E25,a,SORT(CHOOSE({1,2},stub,value),2,-1),r,ROWS(a),FILTER(a,(INDEX(a,0,2)>=LARGE(value,3))+(INDEX(a,0,2)<=SMALL(value,3))))
P12:P17P12=INDEX($D:$D,AGGREGATE(15,6,ROW($E$12:$E$25)/($E$12:$E$25=Q12),COUNTIF($Q$12:$Q12,Q12)))
Q12:Q17Q12=IF(ROWS(Q$12:Q12)<=3,LARGE($E$12:$E$25,ROWS(Q$12:Q12)),SMALL($E$12:$E$25,7-ROWS(Q$12:Q12)))
Dynamic array formulas.


Formula J12: If you have LET, this is the easiest. The D12:D25 is the column with the stubs, and the E12:E25 is the column with the values. To get the list for the other columns, just change E12:E25 to F12:F25, G12:G25, etc.

Formula M12: Again if you have LET, this works almost the same as the previous formula, but it will show ties (Aigle and Herno both have 24 which is the third lowest value).

Formulas P12:Q12: If you don't have LET and you want do do this in Excel 2016, these formulas are the equivalent of the J12 formula.
 
Upvote 0
Solution
Here are a few options:

Book1
DEFGHIJKLMNOPQ
12Canada Goose37282627Moncler44Moncler44Moncler44
13Moncler44272833Columbia41Columbia41Columbia41
14Burberry31211623Moose Knuckles38Moose Knuckles38Moose Knuckles38
15The North Face28232424Herno24Aigle24Aigle24
16Patagonia28212121Woolrich17Herno24Woolrich17
17Arc'teryx1591213Arc'teryx15Woolrich17Arc'teryx15
18Columbia41263132Arc'teryx15
19Duvetica31221919
20Mammut32181721
21Aigle24161115
22Herno24181918
23Moose Knuckles38271111
24Parajumpers281266
25Woolrich171588
26
Sheet1
Cell Formulas
RangeFormula
J12:K17J12=LET(stub,D12:D25,value,E12:E25,a,SORT(CHOOSE({1,2},stub,value),2,-1),r,ROWS(a),s,SEQUENCE(r),FILTER(a,(s<=3)+(s>r-3)))
M12:N18M12=LET(stub,D12:D25,value,E12:E25,a,SORT(CHOOSE({1,2},stub,value),2,-1),r,ROWS(a),FILTER(a,(INDEX(a,0,2)>=LARGE(value,3))+(INDEX(a,0,2)<=SMALL(value,3))))
P12:P17P12=INDEX($D:$D,AGGREGATE(15,6,ROW($E$12:$E$25)/($E$12:$E$25=Q12),COUNTIF($Q$12:$Q12,Q12)))
Q12:Q17Q12=IF(ROWS(Q$12:Q12)<=3,LARGE($E$12:$E$25,ROWS(Q$12:Q12)),SMALL($E$12:$E$25,7-ROWS(Q$12:Q12)))
Dynamic array formulas.


Formula J12: If you have LET, this is the easiest. The D12:D25 is the column with the stubs, and the E12:E25 is the column with the values. To get the list for the other columns, just change E12:E25 to F12:F25, G12:G25, etc.

Formula M12: Again if you have LET, this works almost the same as the previous formula, but it will show ties (Aigle and Herno both have 24 which is the third lowest value).

Formulas P12:Q12: If you don't have LET and you want do do this in Excel 2016, these formulas are the equivalent of the J12 formula.

Thanks you so much Eric :) :)
 
Upvote 0

Forum statistics

Threads
1,214,909
Messages
6,122,189
Members
449,072
Latest member
DW Draft

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