Forum Discussion

Nick_Cox_1943's avatar
Nick_Cox_1943
Copper Contributor
Jul 17, 2024

date entry

How do I enter dates prior to 1900 that I can sort?

1 Reply

  • djclements's avatar
    djclements
    Silver Contributor

    Nick_Cox_1943 Enter them as Text in yyyymmdd format. Use a delimiter, if preferred (e.g. yyyy-mm-dd), but they must always contain 4 characters for year, 2 characters for month and 2 characters for day, and must always be arranged in year-month-day order (e.g. "0500-07-01" for "July 1, 500").

     

    If your version of Excel supports the LAMBDA function, you could also create a custom function in Name Manager called TEXTDATE with the following formula:

     

    =LAMBDA(y,m,d,[delimiter], TEXTJOIN(delimiter,, TEXT(y, "0000"), TEXT(m, "00"), TEXT(d, "00")))

     

    Which can then be used in the worksheet like any other function:

     

    =TEXTDATE(500,7,1,"-")

     

    Sorting dates entered in this format would look something like this:

     

    Sort Date Strings

     

    Likewise, you could also enter them as Numbers in ymmdd format (e.g. 5000701), where the months and days are always 2 characters each, then apply custom cell formatting to display them as desired (e.g. 0000-00-00).

     

    Alternatively, you could input Years, Months and Days in separate columns, then use Custom Sort to sort by three levels.

     

    Please see the attached sample workbook, if needed...

Resources