List of top 10 entries between dates

VOR

Board Regular
Joined
Apr 11, 2009
Messages
59
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hello all,
I am trying to work out how to make a formula to list the top 10 names in J11 and K11 based on how many times they appear on the list in A:B
To make it even more complex, I would like to have the formula refer to the date range in J8 and J9.

Any help would be much appreciated.

Being Excel 2019 I do not have the new dynamic formulas.
 

Attachments

  • Screenshot 2021-08-26 072623.jpg
    Screenshot 2021-08-26 072623.jpg
    101.9 KB · Views: 13

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You Can Use Pivot Table to sort out you problem.

26-08-21 Exp.xlsx
ABCDEFGH
1DateNameDate(Multiple Items)
28/26/2021david
38/26/2021THOMASRow LabelsCount of Name
48/26/2021SANDRATHOMAS6
58/29/2021ROSSROSS5
68/29/2021ROSSSANDRA4
78/29/2021daviddavid3
88/29/2021VICTORIANICK1
99/2/2021THOMASVICTORIA1
109/2/2021NICKGrand Total20
119/2/2021SANDRA
129/2/2021SANDRA
139/6/2021ROSS
149/6/2021SANDRA
159/6/2021ROSS
169/6/2021ROSS
179/10/2021THOMAS
189/10/2021THOMAS
199/10/2021THOMAS
209/13/2021THOMAS
219/13/2021david
229/15/2021david
Sheet11
 
Upvote 0
Thanks Muhammad_Usman, I don't think a Pivot table will update automatically or refer to the dates selected. I was looking for an overview style report which is why I was looking for a formula to be honest.
Thanks for looking though, if you have any other idea's I would welcome them.
 
Upvote 0
Put this array formula in E2 (helpercolumn).

Excel Formula:
=IFERROR(INDEX($B$1:$B$26;SMALL(IF(($A$1:$A$26>=$J$8)*($A$1:$A$26<=$J$9);ROW($1:$26));ROW(A1)));"")

This in G2 (wanted output) Close both formula's with ctrl+shift+return.
Excel Formula:
=INDEX($E$1:$E$26;MAX(((LARGE(COUNTIFS($E$1:$E$26;$E$1:$E$26;$E$1:$E$26;"><")+(ROW($1:$26)/1000);SUM(COUNTIF($G$1:G1;OFFSET($E$1;;;SUMPRODUCT(--($E$1:$E$26<>"")))))+1)=COUNTIFS($E$1:$E$26;$E$1:$E$26;$E$1:$E$26;"><")+(ROW($1:$26)/1000))*ROW($1:$26))))

What about VBA? Able to use that?
 
Upvote 0
Being Excel 2019

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
  • Like
Reactions: VOR
Upvote 0
For example

VBA Code:
Sub jec()
  ar = Sheets(1).Cells(1).CurrentRegion
  With CreateObject("scripting.dictionary")
     For i = 1 To UBound(ar)
        If ar(i, 1) >= [J8] And ar(i, 1) <= [J9] Then .Item(ar(i, 2)) = .Item(ar(i, 2)) + 1
     Next
    Sheets(1).Cells(1, 4).Resize(.Count, 2) = Application.Transpose(Array(.keys, .items))
  End With
   
  With Sheets(1).Range("E1").CurrentRegion
     .Sort [E1], 2, , , , , , 0
     .Offset(5).ClearContents
  End With
End Sub
 
Upvote 0
Using Mohamed's Data here is an Mcode from Power Query. PQ will update when new data is added to the source table by clicking on the Refresh All Icon

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Name", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"
 
Upvote 0
For example

VBA Code:
Sub jec()
  ar = Sheets(1).Cells(1).CurrentRegion
  With CreateObject("scripting.dictionary")
     For i = 1 To UBound(ar)
        If ar(i, 1) >= [J8] And ar(i, 1) <= [J9] Then .Item(ar(i, 2)) = .Item(ar(i, 2)) + 1
     Next
    Sheets(1).Cells(1, 4).Resize(.Count, 2) = Application.Transpose(Array(.keys, .items))
  End With
  
  With Sheets(1).Range("E1").CurrentRegion
     .Sort [E1], 2, , , , , , 0
     .Offset(5).ClearContents
  End With
End Sub
Thanks Jec, I'm having some trouble inputting the first formula for some reason, I didn't want you to think I was ignoring you. I will keep trying and try the VBA...
 

Attachments

  • Screenshot 2021-08-26 131314.jpg
    Screenshot 2021-08-26 131314.jpg
    192.5 KB · Views: 5
Upvote 0
Ahh I see. You have to replace all the semi colons to a comma (in he formula ; to ,). Im using other regional pc settings.
 
  • Like
Reactions: VOR
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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