+ Reply to Thread
Results 1 to 10 of 10

Excel 2007 : Convert time

  1. #1
    Registered User
    Join Date
    05-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    13

    Convert time

    Hi,

    I have an excel sheet with the below entries:

    55M 25S
    01H 32S
    01H 01M 15S
    01H 03M 11S
    01H 04M 32S

    and I need to convert it into decimal value:

    55:25
    01:00:32
    01:01:15
    01:03:11
    01:04:32

    Please help me with this.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Convert time

    One way assuming your data is in A2 down
    In B2
    Please Login or Register  to view this content.
    Drag/Fill Down

    Format Column B Number Format > Custom Type:= hh:mm:ss
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

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

    Re: Convert time

    With a string like that in A2, select B2 and do Insert > Name >Define

    ToTime Refers to: =EVALUATE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, "H ", "/24 + "),"M ", "/1440 + "), "S", "/86400"))

    Then in B2 and copy down, =ToTime

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Convert time

    You could use this formula

    =SUM(MID(A2&"000",FIND({"H","M","S"},A2&"xxHMS")-2,2)/{1,60,3600})/24
    Audere est facere

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

    Re: Convert time

    That's very clever, dll.
    Last edited by shg; 10-15-2011 at 08:38 AM.

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Convert time

    Interesting.

    shgs' solution requires to be saved as a macro-enabled workbook 2007 and later.
    The function EVALUATE(), an Excel 4.0 function is treated as a macro.

    DLLs' formula can be saved as a macro free workbook.

    [EDIT]
    Don't mess with the Time-Lord ... !!!
    Last edited by Marcol; 10-14-2011 at 02:02 PM.

  7. #7
    Registered User
    Join Date
    05-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Convert time

    It worked great, thanks for your help.

    I just got one more spreadsheet with the below entries..

    1day 09H 52M 33S
    2day 06H 31M 28S
    1day 08H 17M 46S

    and needs to be converted in the same way. But, we need to convert the 1 day into hours.

    I would greatly appreciate if you could help me with this.


    Quote Originally Posted by shg View Post
    With a string like that in A2, select B2 and do Insert > Name >Define

    ToTime Refers to: =EVALUATE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, "H ", "/24 + "),"M ", "/1440 + "), "S", "/86400"))

    Then in B2 and copy down, =ToTime

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Convert time

    It worked great, thanks for your help.

    I just got one more spreadsheet with the below entries..

    1day 09H 52M 33S
    2day 06H 31M 28S
    1day 08H 17M 46S

    and needs to be converted in the same way. But, we need to convert the 1 day into hours.

    I would greatly appreciate if you could help me with this.



    Quote Originally Posted by Marcol View Post
    One way assuming your data is in A2 down
    In B2
    Please Login or Register  to view this content.
    Drag/Fill Down

    Format Column B Number Format > Custom Type:= hh:mm:ss

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697

    Re: Convert time

    This formula should work for your previous examples and also the ones with days (up to 99 days)

    =SUM(MID(0&A1&"0000",FIND({"d","H","M","S"},A1&"xxdHMS")-1,2)/{1,24,1440,86400})

    custom format result cell as [hh]:mm:ss - note square brackets - required to show hours totals of 24 or over

  10. #10
    Registered User
    Join Date
    05-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Convert time

    Awesome...thanks much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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