Find top total values with conditions, and tie

Habtest

Board Regular
Joined
Jul 30, 2020
Messages
212
Office Version
  1. 365
Platform
  1. Windows
Hello, I've tried for a while but am not going anywhere.

I'd like that, when year and month are entered in G2 and G3, a top-3 list be generated starting from F6, based on data in column A-D.

The list should contain at least 3 people, when a tie compels expanding the list, expand then conclude the list (scenario 2)

It'd be best not to have helper cell/column.

Appreciate any help!

Book1
ABCDEFGHI
1IDDateNameScoreScenario 1
2KZS0333/28/2021Em180Year2021
3KZS0333/28/2021Em100Month3
4KZI0923/29/2021Dan150
5KZR0093/29/2021Barry50#IDNameScore
6KZI0923/29/2021Dan1801KZI092Dan500
7KZL0943/30/2021Charlie1801KZS033Em500
8KZS0333/30/2021Em403KZL094Charlie180
9KZS0333/31/2021Em180
10KZR0093/31/2021Barry100
11KZI0923/31/2021Dan160Scenario 2
12KZI0923/31/2021Dan10Year2021
13KZS0334/1/2021Em150Month4
14KZS0334/2/2021Em120
15KZR0094/2/2021Barry30#IDNameScore
16KZI0924/3/2021Dan801KZS033Em270
17KZX0664/3/2021Amy102KZR009Barry160
18KZX0664/4/2021Amy202KZL094Charlie160
19KZI0924/4/2021Dan802KZI092Dan160
20KZR0094/5/2021Barry130
21KZX0664/5/2021Amy80
22KZL0944/6/2021Charlie160
Sheet1
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
How about
+Fluff 1.xlsm
ABCDEFGHI
1IDDateNameScore
2KZS03328/03/2021Em180Year2021
3KZS03328/03/2021Em100Month3
4KZI09229/03/2021Dan150
5KZR00929/03/2021Barry50#IDNameScore
6KZI09229/03/2021Dan1801KZS033Em500
7KZL09430/03/2021Charlie1801KZI092Dan500
8KZS03330/03/2021Em403KZL094Charlie180
9KZS03331/03/2021Em180
10KZR00931/03/2021Barry100
11KZI09231/03/2021Dan160
12KZI09231/03/2021Dan10
13KZS03301/04/2021Em150
14KZS03302/04/2021Em120
15KZR00902/04/2021Barry30
16KZI09203/04/2021Dan80
17KZX06603/04/2021Amy10
18KZX06604/04/2021Amy20
19KZI09204/04/2021Dan80
20KZR00905/04/2021Barry130
21KZX06605/04/2021Amy80
22KZL09406/04/2021Charlie160
23
Master
Cell Formulas
RangeFormula
F6:I8F6=LET(Id,UNIQUE(A2:A22),Tot,SUMIFS(D2:D22,B2:B22,">="&DATE(G2,G3,1),B2:B22,"<"&DATE(G2,G3+1,1),A2:A22,Id),Rnk,MATCH((SORT(Tot,,-1)),Tot,0),Srt,SORT(CHOOSE(SEQUENCE(,4),Rnk,Id,XLOOKUP(Id,A2:A22,C2:C22,0),Tot),3,-1),FILTER(Srt,INDEX(Srt,,1)<=3))
Dynamic array formulas.
 
Upvote 0
Another alternative is to use a PivotTable (often overlooked, but still useful ... :) )

With some adjustments (no Subtotal; grouping Dates), a Slicer (Date), Top 3 etc...
I got

Scenario1
Pasta1
ABCD
1
2
3IDNameDate Score
4KZI092Danmar500
5KZS033Emmar500
6KZL094Charliemar180
7Grand Total1180
8
Plan5


Using the Slicer
Scenario 2
Pasta1
ABCD
1
2
3IDNameDate Score
4KZS033Emabr270
5KZR009Barryabr160
6KZI092Danabr160
7KZL094Charlieabr160
8Grand Total750
Plan5


Hope this helps

M.
 
Upvote 0
Realised that there is a problem with the formula in post#2.
Use this instead

+Fluff 1.xlsm
ABCDEFGHI
1IDDateNameScore
2KZS03328/03/2021Em180Year2021
3KZS03328/03/2021Em100Month3
4KZI09229/03/2021Dan150
5KZR00929/03/2021Barry50#IDNameScore
6KZI09229/03/2021Dan1801KZS033Em500
7KZL09430/03/2021Charlie1801KZI092Dan500
8KZS03330/03/2021Em403KZL094Charlie180
9KZS03331/03/2021Em180
10KZR00931/03/2021Barry100
11KZI09231/03/2021Dan160
12KZI09231/03/2021Dan10
13KZS03301/04/2021Em150
14KZS03302/04/2021Em120
15KZR00902/04/2021Barry30
16KZI09203/04/2021Dan80
17KZX06603/04/2021Amy10
18KZX06604/04/2021Amy20
19KZI09204/04/2021Dan80
20KZR00905/04/2021Barry130
21KZX06605/04/2021Amy80
22KZL09406/04/2021Charlie160
23
Master
Cell Formulas
RangeFormula
F6:I8F6=LET(Id,UNIQUE(A2:A22),Tot,SUMIFS(D2:D22,B2:B22,">="&DATE(G2,G3,1),B2:B22,"<"&DATE(G2,G3+1,1),A2:A22,Id),Rnk,MATCH(Tot,(SORT(Tot,,-1)),0),Srt,SORT(CHOOSE(SEQUENCE(,4),Rnk,Id,XLOOKUP(Id,A2:A22,C2:C22,0),Tot),4,-1),FILTER(Srt,INDEX(Srt,,1)<=3))
Dynamic array formulas.
 
Upvote 0
Solution
Realised that there is a problem with the formula in post#2.
Use this instead

+Fluff 1.xlsm
ABCDEFGHI
1IDDateNameScore
2KZS03328/03/2021Em180Year2021
3KZS03328/03/2021Em100Month3
4KZI09229/03/2021Dan150
5KZR00929/03/2021Barry50#IDNameScore
6KZI09229/03/2021Dan1801KZS033Em500
7KZL09430/03/2021Charlie1801KZI092Dan500
8KZS03330/03/2021Em403KZL094Charlie180
9KZS03331/03/2021Em180
10KZR00931/03/2021Barry100
11KZI09231/03/2021Dan160
12KZI09231/03/2021Dan10
13KZS03301/04/2021Em150
14KZS03302/04/2021Em120
15KZR00902/04/2021Barry30
16KZI09203/04/2021Dan80
17KZX06603/04/2021Amy10
18KZX06604/04/2021Amy20
19KZI09204/04/2021Dan80
20KZR00905/04/2021Barry130
21KZX06605/04/2021Amy80
22KZL09406/04/2021Charlie160
23
Master
Cell Formulas
RangeFormula
F6:I8F6=LET(Id,UNIQUE(A2:A22),Tot,SUMIFS(D2:D22,B2:B22,">="&DATE(G2,G3,1),B2:B22,"<"&DATE(G2,G3+1,1),A2:A22,Id),Rnk,MATCH(Tot,(SORT(Tot,,-1)),0),Srt,SORT(CHOOSE(SEQUENCE(,4),Rnk,Id,XLOOKUP(Id,A2:A22,C2:C22,0),Tot),4,-1),FILTER(Srt,INDEX(Srt,,1)<=3))
Dynamic array formulas.
Thanks Fluff, works perfectly, and TIL something new with CHOOSE()

Thanks Marcelo, it also works, though this particular task doesn't allow much leeway for re-format, such as pivot table and helper cells.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

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