sort dates inside a cell

Hello. Is it possible to chronologically sort a number of dates inside a cell, that are not dates but strings?
20170629
20190507
20010406
20040706
20031209
20061226
20031209
20060815
20050426
20061221
20090407
20080904
20100331
20170704
I want to have the oldest date on the top. Alternatively, is there a way to extract the oldest date?
Thank you.

Hi @lafringuella

If they are all in a single cell, you could use Cell Splitter o split on \n but split to a list rather than columns.

Then Ungroup the list to generate rows.

Sort the rows

Then use GroupBy to concatenate with \n again (selecting ‘retain row order’) to put them back in the single cell


If you want to extract the oldest date, after sorting into ascending date order, simply use Row Filter to give you the first row.

2 Likes

@lafringuella
You could split the data as mentioned by @takbb , do your sorting and as far as I know (if you write it to an excel file) there are the XLS Merger nodes which allow you to merge cells.
Have not used it myself but might be an option for you
br

Thank you @takbb for the suggestion. I will try that!

@Daniel_Weikert I will definitely look into that as the outcome will eventually be an Excel file :slight_smile:

@takbb Is there an option in the ungroup node to create rows? The ungrouped result looks exactly like the column before the splitting.

image

Hi @lafringuella , yes the ungroup node will create new rows for each element in the list. So if it isn’t it means that what appears to be a list of elements is actually a list of just one very long element :wink:

which I suspect means the problem you have is the config on the Cell Splitter. This is what Cell Splitter should look like in order to treat newlines as delimiter. My guess is you haven’t ticked the “escape” box, which is an easy thing to overlook. (especially as I neglected to mention it on my previous response :face_with_peeking_eye: )…

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.