Sorting Formula Generated Dates in a Table Excel 2013

BrerRabbit

Board Regular
Joined
Aug 20, 2023
Messages
84
Office Version
  1. 2021
  2. 2016
  3. 2013
Platform
  1. Windows
I have a table that is populated solely by formula. One of those columns is dates generated by formula from another table. I've discovered that bcuz the date column is formula getting data from another table I can't sort it even though excel does recognise the date column as dates. Both tables are dynamic and are updated with more information added. So I need to account for blank rows as well.

Is there a index match offset countif type formula that I can use to put the dates in another table in chronological order?
I found this at ExcelDemy but couldn't make it work. I've found nothing else: =IFERROR(INDEX($D$5:$D$11, MATCH(ROWS($D$10:D10), COUNTIF($D$5:$D$11, "<="&$D$5:$D$11), 0)), "")

The data looks like this. The date is generated using this formula: =IF(D1<>"",IF(NUMBERVALUE(MID(D1,4,2))>=7,DATEVALUE(LEFT(D1,5)&$A$1),DATEVALUE(LEFT(D1,5)&$B$1)),"")
/22/23
1​
03/07 APPLES
03-07-22​
2​
10/07 ORANGES
10-07-22​
3​
20/07 CHERRIES
20-07-22​
4​
17/07 STRAWBERRIES
17-07-22​
5​
31/07 ORANGES
31-07-22​

I need the data in the new table to look like this:

/22/23
1​
03/07 APPLES
03-07-22​
2​
10/07 ORANGES
10-07-22​
4​
17/07 STRAWBERRIES
17-07-22​
3​
20/07 CHERRIES
20-07-22​
5​
31/07 ORANGES
31-07-22​
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
What about something like this (col H)?
I have also included a shorter way you might like to consider for the dates in the original table (col F).

23 11 04.xlsm
ABCDEFGH
1/22/23103/07 APPLES3/07/20223/07/20223/07/2022
222210/07 ORANGES10/07/202210/07/202210/07/2022
3320/07 CHERRIES20/07/202220/07/202217/07/2022
4417/07 STRAWBERRIES17/07/202217/07/202220/07/2022
5531/07 ORANGES31/07/202231/07/202231/07/2022
6   
7   
8   
9   
10   
Sort Dates
Cell Formulas
RangeFormula
E1:E10E1=IF(D1<>"",IF(NUMBERVALUE(MID(D1,4,2))>=7,DATEVALUE(LEFT(D1,5)&$A$1),DATEVALUE(LEFT(D1,5)&$B$1)),"")
F1:F10F1=IF(D1="","",DATEVALUE(LEFT(D1,5)&"/"&A$2+(MID(D1,4,2)-6<0)))
H1:H10H1=IFERROR(AGGREGATE(15,6,E$1:E$6,ROWS(H$1:H1)),"")


If you did want to sort both columns of the table ..

Cell Formulas
RangeFormula
G1:G10G1=IF(H1="","",INDEX(D:D,AGGREGATE(15,6,ROW(D$1:D$10)/(E$1:E$10=H1),COUNTIF(H$1:H1,H1))))
H1:H10H1=IFERROR(AGGREGATE(15,6,E$1:E$6,ROWS(H$1:H1)),"")
E1:E10E1=IF(D1<>"",IF(NUMBERVALUE(MID(D1,4,2))>=7,DATEVALUE(LEFT(D1,5)&$A$1),DATEVALUE(LEFT(D1,5)&$B$1)),"")
I bow before your greatness, you awesome Excel guru you.
I finally got to experiment with your formulae after the weekend not really expecting your formula to handle the duplicate issue. I was wrong. Dead wrong. You absolute legend.

BTW, thank you.
 
Upvote 0
You're welcome. Thanks for the follow-up. (y)
.. and for your kind words. :)
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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