+ Reply to Thread
Results 1 to 10 of 10

Help please converting time formatting

  1. #1
    Registered User
    Join Date
    12-27-2013
    Location
    Oklahoma City
    MS-Off Ver
    Excel 2003
    Posts
    49

    Help please converting time formatting

    I am working from an exported data set of Labratory tests, and I need to time from patients arrival to tiem they had a test performed.

    The exported file has arrival date and time in one cell, and I use "text to columns" to separate date an time.
    The date changes to a standard short date format - great, that what I need
    The time is just a "general" format, ie 11:14PM
    however I need time to be in military format so I can calculate change in time. so I need 11:14PM to read 23:14, but when I change the formatting of the cell to military time, the cell still reads 11:14PM

    Any help greatly appreciated

    (I attempted to attach a file, but the website says I do not have permission to perform that task)

  2. #2
    Registered User
    Join Date
    12-27-2013
    Location
    Oklahoma City
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Help please converting time formatting

    I think this let me attach the file
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-27-2013
    Location
    Oklahoma City
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Help please converting time formatting

    by the way, I did attempt to separate the date and time with =int(A2), but only received #value!

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Help please converting time formatting

    To extract date =LEFT(A2,10)*1 and format as needed
    To extract time =SUBSTITUTE(RIGHT(A2,LEN(A2)-12),"PM", " "&"PM")+0 and also format as needed

  5. #5
    Registered User
    Join Date
    12-27-2013
    Location
    Oklahoma City
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Help please converting time formatting

    nope, tried that one already also. doesn't work... I can get the date out just fine with Text to columns" just can't get the time out

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help please converting time formatting

    If you select column A and find & replace "AM" with " AM" and "PM" with " PM" (all sans quotes) the values willl be converted from text to dates. Then you can format however you wish.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: Help please converting time formatting

    Without changing anything else in your file, you can get the date using this formula (e.g. in H2):

    =DATE(MID(A2,7,4),LEFT(A2,2),MID(A2,4,2))

    and the time using this formula (e.g. in I2):

    =TIMEVALUE(MID(A2,12,5)&":00 "&RIGHT(TRIM(A2),2))

    Format I2 as a time, then copy the formulae down.

    Hope this helps.

    Pete

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Help please converting time formatting

    C2=--TEXT((MID(TRIM(A2),12,LEN(TRIM(A2))-13)&" "&RIGHT(TRIM(A2),2)),"hh:mm")
    TRY THIS AND COPY TOWARDS DOWN
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  9. #9
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Help please converting time formatting

    Quote Originally Posted by dan_fash View Post
    nope, tried that one already also. doesn't work... I can get the date out just fine with Text to columns" just can't get the time out
    Strange, works perfectly for me

  10. #10
    Registered User
    Join Date
    12-27-2013
    Location
    Oklahoma City
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Help please converting time formatting

    thank you all, got it!

+ 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. Replies: 2
    Last Post: 07-22-2014, 09:20 AM
  2. [SOLVED] Converting an elapsed time in decimal number format to an actual time :S
    By Spicey_888 in forum Excel General
    Replies: 3
    Last Post: 07-20-2014, 08:53 PM
  3. Converting Time and Conditional Formatting
    By skate1991 in forum Excel General
    Replies: 1
    Last Post: 01-04-2012, 02:26 PM
  4. Replies: 2
    Last Post: 10-12-2011, 10:54 AM
  5. Converting 4 digit number to time unit and extrapolating time to run from there
    By shaunsul in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-31-2011, 08:01 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