+ Reply to Thread
Results 1 to 9 of 9

Unable to sort dates in column correctly

  1. #1
    Registered User
    Join Date
    05-01-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Exclamation Unable to sort dates in column correctly

    Hi all,
    I'm having a lot of problem sorting the dates in column A either in descending or ascending order in my excel worksheet and unable to find a solution. The problem with the dates is that it is arrange as ddd yyyy/mm/dd, eg Mon 2014 Dec 12. When I use the sort function it runs according to the day - ddd (first alphabet). eg:

    In Ascending order:
    Thu 2014 Dec 12
    Thu 2014 Dec 18
    Tue 2014 Dec 10
    Wed 2014 Dec 11

    Want I need is that the dates arrange in sequence from either newest to the oldest but it work that way in the excel sort function.

    I thought of splitting the dates using texttocolumn function to sort but then I have data in the other columns , so it will over ride the data and there is also the headers on the first roll of each columns. After doing that, I will need to delete those "date" columns and retain the original column A.

    Can anyone help??

    Thanks upfront.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Unable to sort dates in column correctly

    When I tried it, it worked for me. Can you attach a copy of your file?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    05-01-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Unable to sort dates in column correctly

    Hi Mumps1,
    Sorry for the late reply, been working like mad.

    As you can see from my previous post

    Wed 2014 Dec 11 should be on top of the list of dates but its at the bottom b'cos it follows the first alphabet of the ddd

    Thanks

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Unable to sort dates in column correctly

    As I mentioned in my last post, I can't reproduce the problem you're having. It would be helpful if you could attach a copy of your file so that I can have a look at how your data is organized.

  5. #5
    Registered User
    Join Date
    05-01-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Unable to sort dates in column correctly

    Hi Mumps1

    I just uploaded a draft copy of my dates problem. As you can see Jan 14 isn't on the top of the date column but it sort according to the first alphabet of the day, which is Fri followed by Thu and Wed. I want it to be sort either the latest or oldest, which is

    Tue 2014 Jan 14
    Thu 2014 Jan 16
    Wed 2014 Feb 20
    Fri 2014 Mar 12
    Wed 2014 May 13

    Please help
    Attached Files Attached Files

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Unable to sort dates in column correctly

    Try the attached file. You had the cells formatted as 'General' instead of 'Date' or 'Custom'. I reformatted the cells as 'Custom': ddd yyyy mmm dd. When you enter the dates, enter them day/month/year, for example: 15/05/14. You may need to extend the formatting down the column if you add more rows. It should work now.
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Unable to sort dates in column correctly

    Hi
    As Mumps1 mentioned, your data was being treated as text since it was not formatted or entered as dates.

    If you have an large list of such data, re-typing them as valid dates would be onerous.

    Here is a macro that can convert them to valid Excel dates.
    Select your range of dates (ex. A2:A5 in your example) and then run the macro.

    Notes:
    1. Work on a copy of your file as this replaces the selected text. In case something were to go amiss, you would still have the original.
    2. Each new date will look like this: 'Sat 2014-Dec-13'; you can change the format in Excel or modify the 3nd last line in the macro as needed.
    The results data will now be sorted as dates as you wish.
    3. The macro's code is not the most efficient method but it shows the steps for converting your text into date values.
    Another version could look for the separating spacings to decode the year, month, day etc.
    This version assumes each original data has the same layout. ddd yyyy mmm dd

    Please Login or Register  to view this content.
    Hope this helps a bit.
    - Stu

  8. #8
    Registered User
    Join Date
    05-01-2014
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Unable to sort dates in column correctly

    Thanks Mumps1.

    It works. But the data and dates were given by the employee, so I consolidate them in a master copy, which is the reason why I need to sort all those dates with the data.

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Unable to sort dates in column correctly

    Glad it worked out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dates won't sort correctly
    By efaaonson in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-26-2012, 11:31 PM
  2. How to make slicer sort dates correctly?
    By Elias Hedberg in forum Excel General
    Replies: 1
    Last Post: 08-04-2011, 10:26 AM
  3. How to sort dates correctly?
    By Mark53 in forum Excel General
    Replies: 3
    Last Post: 01-10-2011, 07:35 PM
  4. VB data sorting macro unable to sort correctly
    By Ace of Clubs in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-13-2009, 01:46 AM
  5. My dates won't sort correctly?
    By kdietze in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-28-2007, 04:22 PM

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