Formula to extract data from a list without blank space and sort it with the earliest date.

woah

New Member
Joined
May 10, 2023
Messages
24
Office Version
  1. 2016
Platform
  1. Windows
Hi there,

I would like to extract the data from the list of period ("Column F") without the blank space, and sort it with the earliest date. Here is the example. I want it to come out with the result like cell F4 and F5.

What formula can I use for this case? Thank you very much


Time.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
how do you determine which is the earliest date? The values in column F are not dates, they are text strings?
I know they are date ranges, but those do not sort easily as you have those date strings defined.
 
Upvote 0
this is using a helper column for the first date:

Mr excel questions 35.xlsm
ABCDEF
1
2
3
4Time 122/5/2023 - 4/6/2023
5Time 28/5/2023 - 21/5/2023
6Time 3 
7Time 4 
8Time 5 
9
102023-05-2222/5/2023 - 4/6/2023
11
12
13
14
15
16
17
18
19
202023-05-088/5/2023 - 21/5/2023
21
22
23
woah
Cell Formulas
RangeFormula
F4:F8F4=IFERROR(INDEX($F$10:$F$29,AGGREGATE(15,6,1/(1/((--(ISNUMBER($E$10:$E$29))*(ROW($E$10:$E$29)-9)))),ROWS($E$10:$E10))),"")
E10E10=DATE(2023,5,22)
E20E20=DATE(2023,5,8)
 
Upvote 0
It is a formula array. It's long but you get what you need.
Dante Amor
ABCDEFG
1
2
3
4Time 115/4/2023 - 30/4/2023
5Time 21/5/2023 - 7/5/2023
6Time 38/5/2023 - 21/5/2023
7Time 422/5/2023 - 4/6/2023
8Time 55/6/2023 - 10/6/2023
9
10
1122/5/2023 - 4/6/2023
12
13
148/5/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
201/5/2023 - 7/5/2023
21
22
2315/4/2023 - 30/4/2023
24
Hoja8 (2)
Cell Formulas
RangeFormula
F4:F8F4=INDEX($F$11:$F$100,MAX((SMALL(IF($F$11:$F$100<>"",DATEVALUE(LEFT($F$11:$F$100,FIND("-",$F$11:$F$100)-2))),ROWS(E$4:E4))=IF($F$11:$F$100<>"",DATEVALUE(LEFT($F$11:$F$100,FIND("-",$F$11:$F$100)-2))))*(ROW($F$11:$F$100)))-ROW($F$11)+1)
Press CTRL+SHIFT+ENTER to enter array formulas.




----- --
This is another shorter option, but the dates should be as in your example: "8/5/2023 - 21/5/2023", that is, without the leading zero: 05/08/2023 - 05/21/2023
Dante Amor
ABCDEFG
1
2
3
4Time 115/4/2023 - 30/4/2023
5Time 21/5/2023 - 7/5/2023
6Time 38/5/2023 - 21/5/2023
7Time 422/5/2023 - 4/6/2023
8Time 55/6/2023 - 10/6/2023
9
10
1122/5/2023 - 4/6/2023
12
13
148/5/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
201/5/2023 - 7/5/2023
21
22
2315/4/2023 - 30/4/2023
24
Hoja8
Cell Formulas
RangeFormula
F4:F8F4=VLOOKUP(TEXT(SMALL(IF($F$11:$F$100<>"",DATEVALUE(LEFT($F$11:$F$100,FIND("-",$F$11:$F$100)-2))),ROWS(E$4:E4)),"d/m/aaaa")&"*",$F$11:$F$100,1,0)
Press CTRL+SHIFT+ENTER to enter array formulas.





--------------
Let me know the result and I'll get back to you as soon as I can.
Sincerely
Dante Amor
--------------
 
Upvote 0
I would like to extract the data from the list of period ("Column F") without the blank space, and sort it with the earliest date.
Is it possible with your data that 2 (or more) periods can start on the same date?
 
Upvote 0
Unfortunately, they sometimes start with the different date
That isn't entirely clear to me. My question was
Is it possible with your data that 2 (or more) periods can start on the same date?
That is could there be data like this where both of the yellow periods start on 15 April 2023?

23 05 11.xlsm
F
1122/5/2023 - 4/6/2023
12
13
1415/4/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
20
21
22
2315/4/2023 - 30/4/2023
Extract List
 
Upvote 0
That isn't entirely clear to me. My question was

That is could there be data like this where both of the yellow periods start on 15 April 2023?

23 05 11.xlsm
F
1122/5/2023 - 4/6/2023
12
13
1415/4/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
20
21
22
2315/4/2023 - 30/4/2023
Extract List

Yes, it could be. Your photo is one of the examples that I will come across with. Thanks.
 
Upvote 0
It is a formula array. It's long but you get what you need.
Dante Amor
ABCDEFG
1
2
3
4Time 115/4/2023 - 30/4/2023
5Time 21/5/2023 - 7/5/2023
6Time 38/5/2023 - 21/5/2023
7Time 422/5/2023 - 4/6/2023
8Time 55/6/2023 - 10/6/2023
9
10
1122/5/2023 - 4/6/2023
12
13
148/5/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
201/5/2023 - 7/5/2023
21
22
2315/4/2023 - 30/4/2023
24
Hoja8 (2)
Cell Formulas
RangeFormula
F4:F8F4=INDEX($F$11:$F$100,MAX((SMALL(IF($F$11:$F$100<>"",DATEVALUE(LEFT($F$11:$F$100,FIND("-",$F$11:$F$100)-2))),ROWS(E$4:E4))=IF($F$11:$F$100<>"",DATEVALUE(LEFT($F$11:$F$100,FIND("-",$F$11:$F$100)-2))))*(ROW($F$11:$F$100)))-ROW($F$11)+1)
Press CTRL+SHIFT+ENTER to enter array formulas.




----- --
This is another shorter option, but the dates should be as in your example: "8/5/2023 - 21/5/2023", that is, without the leading zero: 05/08/2023 - 05/21/2023
Dante Amor
ABCDEFG
1
2
3
4Time 115/4/2023 - 30/4/2023
5Time 21/5/2023 - 7/5/2023
6Time 38/5/2023 - 21/5/2023
7Time 422/5/2023 - 4/6/2023
8Time 55/6/2023 - 10/6/2023
9
10
1122/5/2023 - 4/6/2023
12
13
148/5/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
201/5/2023 - 7/5/2023
21
22
2315/4/2023 - 30/4/2023
24
Hoja8
Cell Formulas
RangeFormula
F4:F8F4=VLOOKUP(TEXT(SMALL(IF($F$11:$F$100<>"",DATEVALUE(LEFT($F$11:$F$100,FIND("-",$F$11:$F$100)-2))),ROWS(E$4:E4)),"d/m/aaaa")&"*",$F$11:$F$100,1,0)
Press CTRL+SHIFT+ENTER to enter array formulas.





--------------
Let me know the result and I'll get back to you as soon as I can.
Sincerely
Dante Amor
--------------
Thank you. However, if some of the data might the same start date but with different end date, or vice versa. Your formula won't work.

Just like this list.

Date.png
 
Upvote 0
That isn't entirely clear to me. My question was

That is could there be data like this where both of the yellow periods start on 15 April 2023?

23 05 11.xlsm
F
1122/5/2023 - 4/6/2023
12
13
1415/4/2023 - 21/5/2023
15
16
175/6/2023 - 10/6/2023
18
19
20
21
22
2315/4/2023 - 30/4/2023
Extract List

Some of the data might the same start date but with different end date, or vice versa. Just like this.

1683787077244.png
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,180
Members
452,615
Latest member
bogeys2birdies

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