old top 10 dates

Danny54

Active Member
Joined
Jul 3, 2019
Messages
295
Office Version
  1. 365
Platform
  1. Windows
How would I go about getting a listing of the oldest 5 dates from a column? Using the formula, it returns the date as a number with count


My data in in columns A:F Results from formula in col I

=INDEX(SORTBY(UNIQUE(F1:F9)&" = "&COUNTIFS(F1:F9,UNIQUE(F1:F9)),COUNTIFS(F1:F9,UNIQUE(F1:F9)),-1),SEQUENCE(5))




1​
1​
1​
1​
1​
5/14/2016​
42504 = 2
2​
2​
2​
2​
2​
5/14/2016​
43234 = 1
1​
1​
1​
1​
1​
5/14/2018​
43630 = 1
1​
1​
1​
1​
1​
6/14/2019​
43965 = 1
1​
1​
1​
1​
1​
5/14/2020​
41804 = 1
1​
1​
1​
1​
1​
6/14/2014​

Thanks
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
What do you want it to return?
 
Upvote 0
You can try something like:

=INDEX(TEXT(SORT(UNIQUE(F1:F9)),"mm/dd/yyyy"),SEQUENCE(5))&" = "&COUNTIF(F1:F9,INDEX(SORT(UNIQUE(F1:F9)),SEQUENCE(5)))


but this is a great example where using 2 columns for your data is better than trying to combine two values in one. You could use

=INDEX(SORT(UNIQUE(F1:F9)),SEQUENCE(5))

in I1, and format the column as a date, and use

=COUNTIF(F1:F9,I1#)

in J1 and you have 2 shorter, easier formulas.
 
Last edited:
Upvote 0
Two options depending on if you have the new LET function
+Fluff v2.xlsm
ABCDEFGHIJ
1
21111114/05/201614/05/2016 = 214/05/2016 = 2
32222214/05/201614/05/2018 = 114/05/2018 = 1
41111114/05/201814/06/2019 = 114/06/2019 = 1
51111114/06/201914/05/2020 = 114/05/2020 = 1
61111114/05/202014/06/2014 = 114/06/2014 = 1
71111114/06/2014
8
9
Master
Cell Formulas
RangeFormula
I2:I6I2=INDEX(SORTBY(TEXT(UNIQUE(F1:F9),"dd/mm/yyyy")&" = "&COUNTIFS(F1:F9,UNIQUE(F1:F9)),COUNTIFS(F1:F9,UNIQUE(F1:F9)),-1),SEQUENCE(5))
J2:J6J2=LET(Uni,UNIQUE(F1:F9),Cif,COUNTIFS(F1:F9,Uni),INDEX(SORTBY(TEXT(Uni,"dd/mm/yyyy")&" = "&Cif,Cif,-1),SEQUENCE(5)))
Dynamic array formulas.


@Eric W
Unfortunately you're formula does not sort correctly.
 
Upvote 0
@Eric W
Unfortunately you're formula does not sort correctly.
Possible, I'm still using UDFs. But neither of your two formulas match the expected results in Post 3. Why is the oldest date last? Some difference in SORT and SORTBY?

Edit: It appears the expected results are different in post 1 and post 3.
 
Last edited:
Upvote 0
Edit: It appears the expected results are different in post 1 and post 3
Hadn't noticed that.
The OP's formula is sorting by the count, but in post#3 it appears it should be by date.
We'll have to wait & see what the OP says.
If it should be by date then your formula works.
+Fluff v2.xlsm
ABCDEFGHIJK
1
21111114/05/201614/05/2016 = 214/05/2016 = 206/14/2014 = 1
32222214/05/201614/05/2018 = 114/05/2018 = 105/14/2016 = 2
41111114/05/201814/06/2019 = 114/06/2019 = 105/14/2018 = 1
51111114/06/201914/05/2020 = 114/05/2020 = 106/14/2019 = 1
61111114/05/202014/06/2014 = 114/06/2014 = 105/14/2020 = 1
71111114/06/2014
8
9
Master
Cell Formulas
RangeFormula
I2:I6I2=INDEX(SORTBY(TEXT(UNIQUE(F1:F9),"dd/mm/yyyy")&" = "&COUNTIFS(F1:F9,UNIQUE(F1:F9)),COUNTIFS(F1:F9,UNIQUE(F1:F9)),-1),SEQUENCE(5))
J2:J6J2=LET(Uni,UNIQUE(F1:F9),Cif,COUNTIFS(F1:F9,Uni),INDEX(SORTBY(TEXT(Uni,"dd/mm/yyyy")&" = "&Cif,Cif,-1),SEQUENCE(5)))
K2:K6K2=INDEX(TEXT(SORT(UNIQUE(F1:F9)),"mm/dd/yyyy"),SEQUENCE(5))&" = "&COUNTIF(F1:F9,INDEX(SORT(UNIQUE(F1:F9)),SEQUENCE(5)))
Dynamic array formulas.
 
Upvote 0
sweet, worked like a champ. I appreciate all the help. Messing with dates is confusing sometimes.

Have a great date.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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