+ Reply to Thread
Results 1 to 13 of 13

Sort not working in Excel

  1. #1
    Registered User
    Join Date
    05-09-2023
    Location
    British Columbia, Canada
    MS-Off Ver
    365 v 16.2
    Posts
    16

    Sort not working in Excel

    I am having a heck of a time trying to get Excel to sort by date. I've reformatted the dates (mm/dd/yyyy) but it still will not sort correctly, it's all jumbled. Also when I go to Data>Sort and then the dialogue box opens with options, I am not able to choose the column I want to sort (ie: A) and I get an error message saying the there is a missing column/row name. I've double-checked and there are no blank columns. I don't understand why Excel is not recognizing my column headings. See attached file. Any help will be appreciated. Thanks! D
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort not working in Excel

    The data in column A is not dates. It is text that just happens to look like a date. These must be converted to actual date values to sort properly. I have converted them for you using the DATEVALUE function.

    When you look in the formula box your dates look like 01/08/2021. This means it's text. Dates in the formula box are always m/d/yyyy (1/8/2021) no matter what the format of the cell is. (Example uses U.S. format.)

    I was able to choose the column to sort with no problem. Not sure what you did that could not choose a column. Because you have headers you can choose DATE, DESCRIPTION, TIME (not A, B, C).

    Please see revised file attached.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Sort not working in Excel

    The dates ARE dates, but they are in standard UK (and quite a lot of the world outside the US!) format: dd/mm/yyyy.

    This means it's text.
    NOT in the UK and quite a lot of the world outside the US!!!

    Frankly, it's time that Microsoft built something into Excel so that transferring date data from one locale to another is not plagued by this issue.

    I am able to sort the data on the date column just fine.

    This issue is therefore only an issue with this dataset for US-style locales.

    You can tell they are dates by the 5-digit serial numbers that show if you set cloumn A to GENERAL formatting:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    C
    1
    DATE
    DESCRIPTION
    TIME
    2
    44201
    Telephone call and advice to Debbie;
    0.9
    3
    44211
    Telephone call and advice to Debbie;
    0.2
    4
    44214
    Telephone call and advice to Debbie;
    0.2
    5
    44217
    Telephone call and advice to Debbie;
    0.1
    6
    44235
    Telephone call and advice to Debbie;
    0.5
    7
    44238
    Telephone call and advice to Debbie;
    0.5
    8
    44239
    Telephone call and advice to Debbie;
    0.6
    9
    44243
    Telephone call and advice to Debbie;
    0.2
    10
    44252
    Telephone call and advice to Debbie;
    1.0
    11
    44253
    Telephone call and advice to Debbie;
    0.1
    12
    44256
    Telephone call and advice to Debbie;
    0.1
    13
    44257
    Telephone call and advice to Debbie;
    0.3
    14
    44264
    Telephone call and advice to Debbie;
    0.4
    15
    44286
    Telephone call and advice to Debbie;
    0.4
    16
    44288
    Telephone call and advice to Debbie;
    0.1
    17
    44305
    Telephone call and advice to Debbie;
    0.1
    18
    44319
    Telephone call and advice to Debbie;
    0.2
    19
    44337
    Telephone call and advice to Debbie;
    0.5
    20
    44363
    Telephone call and advice to Debbie;
    0.2
    21
    44578
    Telephone call and advice to Debbie;
    0.5
    22
    44579
    Telephone call and advice to Debbie;
    1.5
    23
    44580
    Telephone call and advice to Debbie;
    0.4
    24
    44587
    Telephone call and advice to Debbie;
    0.3
    25
    44595
    Telephone call and advice to Debbie;
    0.3
    26
    44614
    Telephone call and advice to Debbie;
    1.6
    27
    44662
    Telephone call and advice to Debbie;
    0.4
    28
    44722
    Telephone call and advice to Debbie;
    0.3
    29
    44951
    Telephone call and advice to Debbie;
    0.5
    Sheet: Sheet1

    [RANT] I have never understood why anyone would want to use the illogical m/d/yyyy format - you wouldn't use mm:hh:ss. In every other case we grade the items in order from smallest to largest, or from largest to smallest, but not large:smaller:larger!!! If the whole world used dd/mm/yyyy (small:larger:largest - a day is smaller than a month is smaller than a year), then this issue would disappear altogether. [/RANT]
    Last edited by AliGW; 06-15-2023 at 03:30 AM. Reason: Typo fixed.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort not working in Excel

    Changing the cell format in the original file makes no difference in how the data is displayed. When I set the format to General the display does not change. The sorting is a textual sort. When I converted them to date values the sort worked as expected. Regardless of US vs. rest-of-the-world, Excel default date format does not use leading zeroes for day and month. If you see leading zeroes in dates but the cell format is not explicitly dates with leading zeroes, then the data is almost certainly text. I suppose the exception might be if you changed your default Windows settings for date format.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Sort not working in Excel

    Yes, but Jeff, there are NO leading zeroes in the workbook when I open it - they are all legitimate dates in column A.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort not working in Excel

    I don't know how I could reproduce the OP's description of the problem if that were the case. Also the data is left-justified, indicating text. Are you sure you are not looking at my version of the file?

    As opened (note formula box):

    datesbefore.JPG

    After the first date is converted:

    datesafter.JPG

  7. #7
    Registered User
    Join Date
    05-09-2023
    Location
    British Columbia, Canada
    MS-Off Ver
    365 v 16.2
    Posts
    16

    Re: Sort not working in Excel

    Thanks everyone.

    However, I am still not sure why the date format I was using was not working as I have used that date format for years without any issues. I get it though and will just use one of the built-in date formats so I don't have issues going forward. I had formatted it as a date but it made no difference (I understand your explanation though).

    Similarly, I have never had the sorting issue with columns. The error message I get when trying to use the Sort function is "Missing Column/Row Name". Excel does not see my column headings in the file I had uploaded.

    Thanks again.

    D

  8. #8
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Sort not working in Excel

    Quote Originally Posted by Sumsare View Post
    I am having a heck of a time trying to get Excel to sort by date. I've reformatted the dates (mm/dd/yyyy) but it still will not sort correctly,
    check your system date format
    use Power Query to resolve problem
    see attachment (dates are dates, sorted ascending)
    Attached Files Attached Files

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Sort not working in Excel

    Are you sure you are not looking at my version of the file?
    No - I am looking at the OP's original. Why would I need to look at your version? But I will have a look now.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Sort not working in Excel

    I opened your version, Jeff - dates all right-aligned and sortable, just as in the OP's original. As I siad, this data is only going to present an issue for users of a US-style locale.

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    A
    B
    C
    1
    DATE
    DESCRIPTION
    TIME
    2
    05/01/2021
    Telephone call and advice to Debbie;
    0.9
    3
    15/01/2021
    Telephone call and advice to Debbie;
    0.2
    4
    18/01/2021
    Telephone call and advice to Debbie;
    0.2
    5
    21/01/2021
    Telephone call and advice to Debbie;
    0.1
    6
    08/02/2021
    Telephone call and advice to Debbie;
    0.5
    7
    11/02/2021
    Telephone call and advice to Debbie;
    0.5
    8
    12/02/2021
    Telephone call and advice to Debbie;
    0.6
    9
    16/02/2021
    Telephone call and advice to Debbie;
    0.2
    10
    25/02/2021
    Telephone call and advice to Debbie;
    1.0
    11
    26/02/2021
    Telephone call and advice to Debbie;
    0.1
    12
    01/03/2021
    Telephone call and advice to Debbie;
    0.1
    13
    02/03/2021
    Telephone call and advice to Debbie;
    0.3
    14
    09/03/2021
    Telephone call and advice to Debbie;
    0.4
    15
    31/03/2021
    Telephone call and advice to Debbie;
    0.4
    16
    02/04/2021
    Telephone call and advice to Debbie;
    0.1
    17
    19/04/2021
    Telephone call and advice to Debbie;
    0.1
    18
    03/05/2021
    Telephone call and advice to Debbie;
    0.2
    19
    21/05/2021
    Telephone call and advice to Debbie;
    0.5
    20
    16/06/2021
    Telephone call and advice to Debbie;
    0.2
    21
    17/01/2022
    Telephone call and advice to Debbie;
    0.5
    22
    18/01/2022
    Telephone call and advice to Debbie;
    1.5
    23
    19/01/2022
    Telephone call and advice to Debbie;
    0.4
    24
    26/01/2022
    Telephone call and advice to Debbie;
    0.3
    25
    03/02/2022
    Telephone call and advice to Debbie;
    0.3
    26
    22/02/2022
    Telephone call and advice to Debbie;
    1.6
    27
    11/04/2022
    Telephone call and advice to Debbie;
    0.4
    28
    10/06/2022
    Telephone call and advice to Debbie;
    0.3
    29
    25/01/2023
    Telephone call and advice to Debbie;
    0.5
    Sheet: Sheet1

  11. #11
    Registered User
    Join Date
    05-09-2023
    Location
    British Columbia, Canada
    MS-Off Ver
    365 v 16.2
    Posts
    16

    Re: Sort not working in Excel

    I seem to have found a solution to the problem. I was entering the date in format mm/dd/yyyy but there were two issues.

    1. I was entering two digits for the month eg 02 for February.
    2. My location in the format dialogue box was English (Canada)

    I started a new sheet and selected the column where I was going to enter the dates. Then I went to Data>Text to Columns>Delimiter>Next>unticked all checkboxes>Next>check "Date" and chose MYD>Finish. I changed my location to English (United States). Then I went to Custom format and entered mm/dd/yyyy as the format. I then started re-entering the dates without using two digits for months that are only one digit (ie: Jan-Sept) - as I enter the dates and hit enter, Excel then adds a "0" to those months that only have one digit. Then I am able to sort it without any problem.

    Don't know if this will make sense to anyone, but it worked.

    Thanks again for all your input.

    D

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,916

    Re: Sort not working in Excel

    It does make sense - yes. Glad it's sorted!

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  13. #13
    Registered User
    Join Date
    05-09-2023
    Location
    British Columbia, Canada
    MS-Off Ver
    365 v 16.2
    Posts
    16

    Re: Sort not working in Excel

    Ok, thanks for letting me know that, I will certainly do that!

    Best regards

    Debbie

+ 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. Need to Sort Column Data - Horizontal Sort Not Working
    By Jadd in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 11-01-2016, 07:09 PM
  2. [SOLVED] Excel has stopped working... after custom sort
    By jhren in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-28-2014, 04:46 AM
  3. [SOLVED] Sort not working now...
    By ChrisXcel in forum Excel General
    Replies: 5
    Last Post: 04-28-2014, 09:28 PM
  4. [SOLVED] Sort Data not working Excel 2013?
    By nobodyukno in forum Excel General
    Replies: 6
    Last Post: 08-14-2013, 10:31 AM
  5. Alphanumeric sort - Excel 2010 not working
    By nivivani in forum Excel General
    Replies: 7
    Last Post: 07-26-2013, 10:43 AM
  6. Excel 2003 Sort Buttons Not Working Properly
    By crazy1bryan in forum Excel General
    Replies: 2
    Last Post: 08-07-2009, 01:31 PM
  7. [SOLVED] Excel 2003 Data Sort & Subtotaling not working properly
    By Roibn L Taylor in forum Excel General
    Replies: 5
    Last Post: 12-08-2005, 02:10 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