+ Reply to Thread
Results 1 to 10 of 10

Text to Numbers (Dates)

  1. #1
    Registered User
    Join Date
    02-17-2020
    Location
    Louisville, KY
    MS-Off Ver
    2016
    Posts
    43

    Text to Numbers (Dates)

    I downloaded the attached file from a Brokerage website. I see that the dates are actually text. I have tried various conversion techniques (DATE(Cell), etc., but nothing seems to work.
    Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.84 (24041420))
    Posts
    8,797

    Re: Text to Numbers (Dates)

    if you click on the column D
    then use Data>TEXT to columns
    and choose the date as M/D/Y
    it should convert for you

    you have a space at the front of the data
    so i used
    =VALUE(MID(D3,5,2)&"/"&MID(D3,2,2)&"/"&RIGHT(D3,4))
    which converts to a date
    note, i'm UK based hence the DD/MM/YYYY
    format
    then format as MM/DD/YYYY
    Last edited by etaf; 03-27-2020 at 12:48 PM.
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

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

    Re: Text to Numbers (Dates)

    The first thing I did was scroll through the text of one of the cells, and I noticed that each cell with a date string begins with a space character. I then entered =CODE(LEFT(cell,1)) and found that these are 160 non-breaking space characters (the one space character that TRIM() and CLEAN() cannot touch).

    I use a SUBSTITUTE() function to get rid of the non-breaking space SUBSTITUTE(D4,CHAR(160),"").
    Then use a DATEVALUE() function to convert the text string to a date serial number (which assumes my system defaults for date formatting). =DATEVALUE(SUBSTITUTE(...))

    Will that work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    11-14-2011
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Text to Numbers (Dates)

    This works,
    =DATE(RIGHT(E4,4),MID(E4,2,2),MID(E4,FIND("/",E4)+1,2))

    But I think the problem is that there is a leading blank on all those dates, so =Trim(E4) will also do the trick

  5. #5
    Registered User
    Join Date
    02-17-2020
    Location
    Louisville, KY
    MS-Off Ver
    2016
    Posts
    43

    Re: Text to Numbers (Dates)

    OK, my ultimate goal is to sort the table by column D, oldest to newest, and sorry, the only one that works is DomSmith's, but it results in 4 numbers for each date (All others returned either #VALUE or #NUMBER). The result would not sort oldest to newest. However, I then took the results from DomSmith's formula and pasted special-values to another column, formatted it as a short date, and it then let me sort. Thanks to everyone.
    Last edited by jeffkirk; 03-27-2020 at 01:21 PM.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,961

    Re: Text to Numbers (Dates)

    An alternative solution is to employ Power Query. Load the table to PQ and change the date format. Here is the Mcode. Then Close and Load to your Excel file.

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Registered User
    Join Date
    02-17-2020
    Location
    Louisville, KY
    MS-Off Ver
    2016
    Posts
    43

    Re: Text to Numbers (Dates)

    Thanks to all. Unfortunately, I have never worked with (nor ever heard of) "Power Query". Is the added language code? Thanks again.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,961

    Re: Text to Numbers (Dates)

    Look at the links in my signature for more information. It is part of Excel. Look on your Data Tab and it will be either Power Query or renamed Get and Transform.

  9. #9
    Registered User
    Join Date
    02-17-2020
    Location
    Louisville, KY
    MS-Off Ver
    2016
    Posts
    43

    Re: Text to Numbers (Dates)

    Alan, your suggestion re "Power Query worked. Tanks. Now, how can I get rid if the green fill?

  10. #10
    Registered User
    Join Date
    02-17-2020
    Location
    Louisville, KY
    MS-Off Ver
    2016
    Posts
    43

    Re: Text to Numbers (Dates)

    Never mind, I got it.

    WOW, that Power Query is pretty slick.

    I wonder why the EXCEL folks can't parcel out the algorithm that does the conversion and provide it as a separate function?

    Thanks again to all who responded.

+ 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] Marco to convert numbers stored as text to numbers and dates stored as text to numbers
    By a2424 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-22-2014, 10:19 AM
  2. [SOLVED] Dates, Numbers and text need to be pulled in another sheet
    By kesavanprabhu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2013, 05:26 AM
  3. Replies: 9
    Last Post: 03-26-2012, 02:16 PM
  4. converting text dates to numbers
    By thedragon in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2011, 11:56 PM
  5. [SOLVED] VBA to concatenate Text and/or Numbers and/or dates etc
    By donoteventry;removes;[email protected] in forum Excel General
    Replies: 2
    Last Post: 07-24-2006, 09:50 PM
  6. Converting numbers stored as dates to text in Excel
    By David from Furdale in forum Excel General
    Replies: 1
    Last Post: 07-17-2006, 01:40 PM
  7. Replies: 6
    Last Post: 04-30-2005, 11:06 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