Search code examples
libreoffice-calc

Find soonest day of days in this format


I have days saved in pattern like: day dot month, so "11.01" is 11th January and "22.02" is 22th of February. I would like to find soonest (smallest in terms of UNIX timestamp) day.

My current idea is: treat those dates as floats and calculate month: =(A1 - INT(A1)) * 100

but then I cannot reference day and thus cannot sort by it. I probably could create few additional columns and do few mappings, however I need to do it in single cell (cannot add rows/columns) and that complicates whole thing.

Is there better idea than mine?


Solution

  • Based on @Pablo Canseco's idea but extended so that the results look identifiable as dates and can be treated as such (for example subtract one from another to show the days' interval):

    =DATE("2016",RIGHT(A1,2),LEFT(A1,2))
    

    If you want all January dates to sort (ascending) after other months then:

    =DATE(IF(RIGHT(A1)="1","2017","2016"),RIGHT(A1,2),LEFT(A1,2))
    

    either copied down to suit. Copy the column containing the formulae and Paste Special with Selection of Text and Date & time (only) over the top.