+ Reply to Thread
Results 1 to 11 of 11

Convert Hours to Minutes and Seconds

  1. #1
    Registered User
    Join Date
    01-08-2007
    Posts
    3

    Convert Hours to Minutes and Seconds

    Hello all,

    I am trying to use the Mod function to convert the following:

    I have time in hours in A1 as 12.66 and I need it to convert to 12 hours in A2, 39 minutes in A3, and 36 seconds in A4. What formula can I use to achieve this?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    In what format is the 12.66 hours? Is it general/numeric formatting? In other words, is the actual value in the cell 12.66? If so, I didn't use MOD, but here is a way to do it (assume 12.66 is in A1):

    A2 (hour):
    =TRUNC(A1)

    A3 (minute):
    =TRUNC((A1-A2)*60)

    A4 (second):
    =TRUNC(((A1-A2)*60-A3)*60)
    Last edited by jasoncw; 01-08-2007 at 05:36 PM.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,080
    Just use the built in Excel functions

    In A2
    =HOUR(A1)
    In A3
    =MINUTE(A1)
    In A4
    =SECOND(A1)
    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.

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Quote Originally Posted by Special-K
    Just use the built in Excel functions

    In A2
    =HOUR(A1)
    In A3
    =MINUTE(A1)
    In A4
    =SECOND(A1)
    That won't work if the actual number in cell A1 is 12.66 (not a time serial number). Try it.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,706
    I concur with Special K's approach but if you have a decimal figure like 12.66 in A1 then you'll need to use

    =HOUR(A1/24)
    =MINUTE(A1/24)

    and

    =SECOND(A1/24)

    but if the hours might be over 24 then better to use

    =INT(A1) for hours

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hmmm, I thought I tried that and it didn't work... But it does. Sorry for the confusion. Use the formulas from daddylonglegs post.

  7. #7
    Registered User
    Join Date
    01-08-2007
    Posts
    3

    Thanks

    Thanks jasoncw and daddylonglegs formulas both worked. But i have another question because i am so new to excel. I am trying to do the same thing but instead I'm converting X dollars into dollars, quarters, dimes, nickels, and pennies. Any suggestions?

  8. #8
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Well, I hope I don't make myself look too inexperienced again... But I do not believe Excel has any type of built in currency coin counter function. If they do, that would be interesting to see, but if not, here you go:

    [A1] Currency in dollars

    [A2] Dollars:
    =INT(A1)

    [A3] Quarters:
    =INT((A1-A2)*100/25)

    [A4] Dimes:
    =INT(((A1-A2)*100-(A3*25))/10)

    [A5] Nickels:
    =INT(((A1-A2)*100-(A3*25)-(A4*10))/5)

    [A6] Pennies:
    =(A1-A2)*100-(A3*25)-(A4*10)-(A5*5)

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,706
    Do you mean in to the smallest number of each denomination?

    E.g. $8.88

    is 8 dollars
    3 quarters
    1 dime
    3 pennies?

    Here's one way to do it

    If your dollar amount is in A3 then in B2 across put in figures in dollars to represent your denominations so B2 has 1, C2 has 0.25, D2 has 0.1, E2 has 0.05, F2 has 0.01

    [representing dollars, quarters, dimes, nickels and pennies respectively]

    In B3

    =INT(A3/B$2)

    In C3 copied across to F3

    =INT(ROUND(($A3-SUMPRODUCT($B$2:B$2,$B3:B3))/C$2,2))

    You can adapt this for more denominations, e.g. $5, $10, $50 bills etc.

  10. #10
    Registered User
    Join Date
    01-08-2007
    Posts
    3
    you guys are amazing. i have one last question, i promise. on the original formula where i converted time in hours to hours, minutes and seconds...how would i convert lets say 8000 seconds into hours, minutes and seconds?

    thank you, thank you!!!

  11. #11
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,706
    As before there are several ways but I'd use

    =INT(A1/3600)

    =MINUTE(A1/86400)

    =SECOND(A1/86400)

+ 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