+ Reply to Thread
Results 1 to 7 of 7

Converting text to date/time

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    seattle
    MS-Off Ver
    Excel 2007
    Posts
    22

    Converting text to date/time

    I am trying to convert text in a cell from: 03/08/2014 2330 to a date that looks like this: 03/08/2014 23:30. Then I also need to extract just the time only and put that in a new cell.
    I can do it in a few steps by using Data -> Text To Columns, formatting the date and time separately, and then putting them back together again.

    Is there a 1-step way to do the original text to date/time conversion? Ideally a formula?

    Thanks

  2. #2
    Forum Contributor
    Join Date
    02-20-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    170

    Re: Converting text to date/time

    Assume your text cell is A1

    To get the time-only cell, use this formula:

    =TIME(LEFT(RIGHT(A1,4),2),RIGHT(A1,2),0)

    Then to get the date, use this formula:

    =LEFT(A1,FIND(" ",A1))&LEFT(RIGHT(A1,4),2)&":"&RIGHT(A1,2)

    Note: This will still be a text value. As far as I know, Excel can't handle combined date/time formats. If you just want to leave it as the date, shorten the formula to =LEFT(A1,FIND(" ",A1))

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Converting text to date/time

    Try this...

    A1 = 03/08/2014 2330

    Enter this formula in B1:

    =--TEXT(RIGHT(A1,4),"00\:00")

    Format as Time

    Enter this formula in C1:

    =LEFT(A1,10)+B1

    Format as mm/dd/yyyy h:mm AM/PM
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Converting text to date/time

    Or you can actually convert it to a real date and time

    =VALUE(TEXT(LEFT(A2,10),"m/dd/yyyy")&" "&LEFT(RIGHT(A2,4),2)&":"&RIGHT(A2,2))

    Format cell Custom: m/dd/yyyy h:mm

    A
    B
    1
    Format cell Custom: m/dd/yyyy h:mm
    2
    03/08/2014 2330
    3/08/2014 23:30
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    01-28-2014
    Location
    seattle
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Converting text to date/time

    Thank you everyone! The solutions worked.

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Converting text to date/time

    You're welcome and thank you for the feedback!

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Converting text to date/time

    You're welcome. We appreciate the feedback!

+ 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. Converting a text string to date and time
    By stephboucher in forum Excel General
    Replies: 1
    Last Post: 03-21-2012, 02:28 PM
  3. Excel 2007 : Converting a text date and time into a number
    By laurathomas3 in forum Excel General
    Replies: 1
    Last Post: 12-29-2011, 08:56 AM
  4. converting text in cell to a date time
    By Herman in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-22-2005, 03:05 PM
  5. Replies: 0
    Last Post: 08-23-2005, 12:24 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