+ Reply to Thread
Results 1 to 3 of 3

Excel assumes date is 1st when sorting mm format - how to change?

  1. #1
    Registered User
    Join Date
    02-11-2022
    Location
    London
    MS-Off Ver
    2018
    Posts
    3

    Excel assumes date is 1st when sorting mm format - how to change?

    Does anyone know how to ensure that when entering a list of dates in the dd mm yy format and some in the mm yy format that the mm yy dates are sorted to the end of the month rather than excel assuming I meant to put them in as the 1st?
    i.e I want list to appear as

    22/12/22
    23/12/22
    25/12/22
    Dec 22
    Dec 22

    rather than

    Dec 22
    Dec 22
    22/12/22
    23/12/22
    25/12/22

  2. #2
    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,430

    Re: Excel assumes date is 1st when sorting mm format - how to change?

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, relevant cells highlighted and a few explanatory notes.
    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.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: Excel assumes date is 1st when sorting mm format - how to change?

    I am not aware of any way to change this behavior in Excel. When you give Excel a month/year date (and Excel converts to a real date/time serial number), Excel will always assume the 1st of the month. The obvious solution to me is to never give Excel the chance to assume the 1st by always entering the date as well (Dec 31, 2021, for example), but that represents a change to your data entry procedure, and that might not be allowed.

    If you are required to enter mmm yy and have it mean "last date of mmm yy", then you will have to figure out some way to trap the mmm yy entry and change it to last date/mm/yy. If this date entry can never be the first of the month, then a helper cell/column with something like =IF(DAY(date)=1,EOMONTH(date),date) will change all first of the month entries to the last day of the month. But that does not allow for legitimate cases where you need to enter the first of the month.

    If you need to allow for legitimate cases where you enter the first of the month, then you probably end up needing to write your own procedure/algorithm for trapping the data entry as text, examine the text entry to see if it is dd/mm/yy or mmm yy, and then convert the dd/mm/yy text strings to the expected date, and convert mmm yy text strings to last of the month dates.

    It's up to you how you want to approach this. IMO, it is easier to train myself and my users to never enter mmm yy dates if I/we/they mean "last of the month" by that kind of entry. Always enter the date as part of the data entry so Excel cannot make assumptions about the data I am entering. If you decide that you must allow for mmm yy entries that mean last of the month, then I think you will end up writing your own "text to date conversion" procedure that you can run in place of Excel's built in, default algorithm.

    I doubt that writing such an algorithm is prohibitively difficult, but will it be worth the effort to you? How would you like to proceed?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ 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. [SOLVED] How to change date format in excel
    By Sekar G in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-04-2020, 01:10 AM
  2. [SOLVED] Excel Monthveiw Change the date format to Short Date
    By nigelog in forum Excel General
    Replies: 2
    Last Post: 09-09-2016, 12:38 PM
  3. [SOLVED] Typing month and day, excel assumes day is the year
    By tiggynook in forum Excel General
    Replies: 2
    Last Post: 04-17-2014, 02:37 PM
  4. Excel:How change the textbox format from text to date format?
    By inpetto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2013, 08:23 AM
  5. Replies: 3
    Last Post: 01-19-2012, 01:12 AM
  6. Not able to change date format into proper excel date format
    By excel5111987 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2011, 08:19 AM
  7. Replies: 1
    Last Post: 12-07-2005, 12:20 PM

Tags for this Thread

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