+ Reply to Thread
Results 1 to 9 of 9

Convert non-military time to tenths of hours

  1. #1
    Registered User
    Join Date
    08-15-2009
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Convert non-military time to tenths of hours

    I am constucting a time sheet that is driving me nuts. The following formula calculates the employees total time worked in one day (it works fine). The input cells (time in/out) are time formated. The total hours worked cell (which has the formula below in it) is formated as number w/2 decimal places. I can not come up with the correct formula to convert the decimals to tenths of hours and have it match my companies conversion chart. What do I need to do? Thank you to anyone who can help me.

    TOTAL HOURS WORKED:
    '=IF((OR(B15="",B14="")),0,IF((B15<B14),((B15-B14)*24)+24,(B15-B14)*24))+IF((OR(C15="",C14="")),0,IF((C15<C14),((C15-C14)*24)+24,(C15-C14)*24))+IF((OR(E15="",E14="")),0,IF((E15<E14),((E15-E14)*24)+24,(E15-E14)*24))+IF((OR(F15="",F14="")),0,IF((F15<F14),((F15-F14)*24)+24,(F15-F14)*24))

    HOURS CONVERSION CHART (Sample)

    0 min - 2 min, 59 seconds = .0
    3 min - 8 min, 59 seconds = .1
    9 min - 14 min, 59 seconds = .2
    15 min - 20 min, 59 seconds = .3

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

    Re: Convert non-military time to tenths of hours

    If A1 contains an Excel time, then =ROUND(A1 * 240, 0)/10 gives the time in decimal hours to the nearest tenth. Format the result as 0.0
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676

    Re: Convert non-military time to tenths of hours

    Slight variation on that would be

    =ROUND(A1*24,1)

    so to apply that to your formula try

    =ROUND((IF(COUNT(B14:B15)=2,MOD(B15-B14,1))+IF(COUNT(C14:C15)=2,MOD(C15-C14,1))+IF(COUNT(E14:E15)=2,MOD(E15-E14,1))+IF(COUNT(F14:F15)=2,MOD(F15-F14,1)))*24,1)

    Note: this rounds the final count of minutes for the day rather than rounding each individual section and then adding those......which isn't quite the same thing......

  4. #4
    Registered User
    Join Date
    08-15-2009
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert non-military time to tenths of hours

    I've tried all the suggestions and the formula's are not working correctly. I've attached a sample of the time sheet and the conversion chart. I need Sunday to equal 6.9 and Monday to equal 6.4 in the Conversion From Time to Hours column. BTW, I can't use military time to input the hours worked.

    Thanks everyone for your help. I feel like a real dummy on this one.
    Attached Files Attached Files

  5. #5
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676

    Re: Convert non-military time to tenths of hours

    Why 6.9 for Sunday and 6.4 for Monday?

    Sunday has a total of 6 hours 57 minutes which will round to 7 hours given your rounding criteria. Monday has 6 hours 39 minutes which would round to 6.7

    If you use the formula I suggested then those are the results you'll get.....

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

    Re: Convert non-military time to tenths of hours

    Slight variation on that would be =ROUND(A1*24,1)
    Doh!

  7. #7
    Registered User
    Join Date
    08-15-2009
    Location
    Richmond, VA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Convert non-military time to tenths of hours

    I agree but my companies conversion chart is not standard rounding as you can see from the chart. 3 min - 8 min, 59 sec = .1 for Sunday and 21 minutes to 26 min, 59 sec = .4 for Monday.

    And if I use the formula =ROUND(A1*24,1) in Sunday I get 166.8

    Anybody have a glass of wine?

  8. #8
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,676

    Re: Convert non-military time to tenths of hours

    Quote Originally Posted by kwray49 View Post
    I agree but my companies conversion chart is not standard rounding as you can see from the chart. 3 min - 8 min, 59 sec = .1 for Sunday and 21 minutes to 26 min, 59 sec = .4 for Monday.

    And if I use the formula =ROUND(A1*24,1) in Sunday I get 166.8

    Anybody have a glass of wine?
    In fact that is "standard rounding". If you round to the nearest 10th of each hour then anything from 3 mins up to (but not including) 9 mins will round to 0.1.

    If you already have your formula in column G then you have already converted to decimal so you don't need *24. You could simply use this formula in H4 copied down

    =ROUND(G4,1)

    That will give you 7.0 for Sunday and 6.7 for Monday which looks correct to me.

    My previous suggestion does the calculation of hours and the rounding all in one go so that you don't need both columns G and H, i.e. you can use this formula in G4

    =ROUND((IF(COUNT(B4:B5)=2,MOD(B5-B4,1))+IF(COUNT(C4:C5)=2,MOD(C5-C4,1))+IF(COUNT(E4:E5)=2,MOD(E5-E4,1))+IF(COUNT(F4:F5)=2,MOD(F5-F4,1)))*24,1)

  9. #9
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Convert non-military time to tenths of hours

    BTW, I can't use military time to input the hours worked.
    that doesnt matter 23:00 is the same as 11:00 pm just the cell format is different ,the underlying value is the same
    but
    6.65 hours even according to your chart rounds to 6.7 as 0.65 hrs falls in between
    39 and 45
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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