+ Reply to Thread
Results 1 to 12 of 12

Convert text string to date & time help

  1. #1
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Question Convert text string to date & time help

    Hi all,

    Having trouble with formula to convert a text string to a time & date.

    Have attached a sample - am almost there but it's not working.

    I think the AM is screwing things up - anyone help please?

    Ian
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Convert text string to date & time help

    =mid(a2,5,20)+0

    or probably

    =TEXT(MID(A2,5,20)+0,"dd/mm/yyyy hh:mm")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    485

    Re: Convert text string to date & time help

    Try using the following formula and formatting the cell as m/d/yyyy h:mm

    =--REPLACE(A2,1,4,"")

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,921

    Re: Convert text string to date & time help

    Try this ...

    =TEXT(REPLACE(A2,1,4,""),"dd-mm-yyyy hh:mm")

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,317

    Re: Convert text string to date & time help

    Try

    =DATEVALUE(MID(A2,4,12)) + TIMEVALUE(RIGHT(A2,8))

  6. #6
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Convert text string to date & time help

    Thanks all - I started with the most recent solution posted by Phuocam and that worked perfectly. Will mark as solved.

  7. #7
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: Convert text string to date & time help

    Root's is more efficient, as it will leave you with a proper data and time. Phuocam's will leave you with text.
    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.

  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: Convert text string to date & time help

    you've ex365 so you can try PowerQuery, just 2, maybe 3, clicks
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Convert text string to date & time help

    I tell a lie, for some reason, John's solution worked best as the one I first used didn't lock a true time value on it (i.e. when I saved as CSV, it didn't switch to numbers, as I expected it would) whereas John's did. Thanks John!

  10. #10
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Convert text string to date & time help

    Quote Originally Posted by AliGW View Post
    Root's is more efficient, as it will leave you with a proper data and time. Phuocam's will leave you with text.
    Thanks, yes, just discovered this and posted.

  11. #11
    Forum Expert cbatrody's Avatar
    Join Date
    04-15-2014
    Location
    Dubai
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    2,136

    Re: Convert text string to date & time help

    OR,

    Try the following in C2:

    =--RIGHT(A2,LEN(A2)-4)

  12. #12
    Forum Contributor
    Join Date
    08-21-2014
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    232

    Re: Convert text string to date & time help

    Marked solved now, thanks all

+ 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] Convert Date to String/Text
    By newbieobjectcoder in forum Excel General
    Replies: 3
    Last Post: 09-23-2017, 07:05 PM
  2. Replies: 7
    Last Post: 06-19-2017, 06:10 PM
  3. [SOLVED] Convert String or Text to Date
    By biznez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2016, 02:35 PM
  4. [SOLVED] Convert a Text String Date to Date Serial Number
    By herve73 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-10-2015, 10:53 AM
  5. [SOLVED] Convert Text String to Time
    By sal2ahj0y in forum Excel General
    Replies: 2
    Last Post: 05-09-2012, 12:31 PM
  6. Convert date and time to a text string
    By matpaulin in forum Excel General
    Replies: 2
    Last Post: 09-20-2008, 02:12 PM
  7. How do I convert a text string to a time format
    By knighttrader in forum Excel General
    Replies: 8
    Last Post: 01-29-2008, 04:19 AM

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