+ Reply to Thread
Results 1 to 7 of 7

Sorting Dates in format ##/##/## - ##/##/##

  1. #1
    Registered User
    Join Date
    06-04-2006
    Posts
    22

    Sorting Dates in format ##/##/## - ##/##/##

    I have a report and in column A I have dates listed in text format as follows:

    06/04/2008 - 12/04/2008
    20/04/2008 - 26/04/2008
    30/03/2008 - 05/04/2008
    13/04/2008 - 19/04/2008

    How do I go about being able to sort this column so that the date ranges are in the order from earliest to latest?

    I'm guessing the format would need to be changed from text format but I'm unsure how to go about it.

    Also to point out, the above is how it's displayed when the reports are sent to me on a weekly basis.

    Thanks in advance, Steve

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    In an adjacent column paste

    =INT(MID(A1,7,4)& MID(A1,4,2) & MID(A1,1,2))

    into B1 and copy down. You can then sort on this new column to give the rows in order of the first date.
    Martin

  3. #3
    Registered User
    Join Date
    06-04-2006
    Posts
    22
    Cheers.

    Rather than just go ahead and paste it without actually knowing how it's helped, could you explain in a nutshell what the

    =INT(MID(A1,7,4)& MID(A1,4,2) & MID(A1,1,2))

    has done to column A?

  4. #4
    Registered User
    Join Date
    06-04-2006
    Posts
    22
    I've just tried that now and it's displaying #VALUE!

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    =LEFT(A1,10)+0 will extract the first date of each date range... where A1 is location of the date range...

    You may have to format the cell as Date to see a date...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Registered User
    Join Date
    06-04-2006
    Posts
    22
    Thanks I've sorted it.

  7. #7
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    The way that the formula works is to concatenate the year, month and day in that order and create the integer version. The sorting then works like an other numerical sort with the biggest time increments (the years) occupying the highest rank places.

    Its similar to the technique for naming files to include a date in the name and getting them to sort correctly by filename.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1