+ Reply to Thread
Results 1 to 9 of 9

Converting Text to Date & Sorting on Date

  1. #1
    Registered User
    Join Date
    06-12-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Converting Text to Date & Sorting on Date

    Hi everyone.
    I am trying to convert a long list of dates from text to date (see A) so that I can sort them from newest to oldest. I've tried converting them using differnt formulas (see B:C) but these don't work.
    Any suggestions?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    12-16-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Converting Text to Date & Sorting on Date

    try =TEXT(A2, "mmm-dd-yyyy")

    http://www.easyexcelanswers.com

  3. #3
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Converting Text to Date & Sorting on Date

    try this in D2, then copy and paste down

    Please Login or Register  to view this content.
    You can miss out the TEXT(value,"mm/dd/yyyy") if you just want to format the column to your required date formate

    The other part of the formula does..........

    When the string length is 20, this means the day value is only 1 number, like 3rd, 4th, 5th
    When the string length is 21, this means the day value has 2 numbers, like 23rd, 24th, 25th

    Once it's established this, it takes each element of the string value using MID to put the right values into the DATEVALUE formula

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Converting Text to Date & Sorting on Date

    Hi,

    Can't do better than this, I'm afraid:

    =0+SUBSTITUTE(TRIM(SUBSTITUTE(REPLACE(A2,1,3,MATCH(LEFT(A2,3),INDEX(TEXT(30*ROW($1:$12),"mmm"),,),0)),"00:00:00",""))," ","/")

    Must be much better (and shorter) solutions, though.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  5. #5
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Converting Text to Date & Sorting on Date

    oh, btw, this presumes all new date values you'll be working with will always presented in exactly the same format, if you are aware there might be variations let us know and we'll put additional tests into the formula

  6. #6
    Registered User
    Join Date
    06-12-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Converting Text to Date & Sorting on Date

    Thanks easyexcelanswers but I still can't sort from oldest to newest. It will only allow sorting from A-Z which prevents me from using the data.

  7. #7
    Forum Contributor
    Join Date
    01-25-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    434

    Re: Converting Text to Date & Sorting on Date

    Quote Originally Posted by andresndor View Post
    Thanks easyexcelanswers but I still can't sort from oldest to newest. It will only allow sorting from A-Z which prevents me from using the data.
    Sorry, I made a mistake by using the TEXT in the formula, you need to take that out of the formula

    Please Login or Register  to view this content.
    Then format the column to the correct date format you want

    It will then allow sorting as expected

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Converting Text to Date & Sorting on Date

    ...and another offering

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  9. #9
    Registered User
    Join Date
    06-12-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: Converting Text to Date & Sorting on Date

    Thanks for the help everyone.

    I used XOR LX's formula because I needed to make some adjustments and that made the most sense to me.

    But I really appreciate all the other responses.

+ 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. Converting text string that contains a date and time to a date
    By jmforde in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-12-2013, 02:31 PM
  2. [SOLVED] Converting from Text>Date Serial>Date
    By Schwartz in forum Excel General
    Replies: 17
    Last Post: 04-17-2012, 04:26 PM
  3. Converting Text Date to Actual Date using VBA
    By reggie1000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2010, 12:20 PM
  4. Converting date text to date format
    By reggie1000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2009, 06:10 AM
  5. Converting date to month/year and sorting
    By kmontgomery in forum Excel General
    Replies: 2
    Last Post: 03-05-2008, 06:37 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