Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   How do you stop this time calculation formula from rounding (https://www.askmehelpdesk.com/showthread.php?t=312108)

  • Feb 2, 2009, 04:00 PM
    chris1962
    How do you stop this time calculation formula from rounding
    I did not make this formula, but found it on the internet. I am trying to figure out how to make it stop rounding. It is the "total" cell for the "time in" and "time out" on a timesheet. The cell is formatted as "time". I want it to return exact minutes worked and not round. Can someone please help?

    =IF((OR(K8="",K7="")),0,IF((K8
  • Feb 2, 2009, 04:02 PM
    chris1962

    Sorry, prior questions did not post all of the formula.

    Chris

    =IF((OR(K8="",K7="")),0,IF((K8<K7),((K8-K7)*24)+24,(K8-K7)*24))
  • Feb 2, 2009, 04:43 PM
    LinfieldPA
    1 Attachment(s)

    I guess you're trying to calculate wages from someone's TIME IN and TIME OUT? If so, see if the attached makes sense to you. It will calculate number of minutes and calculate wages with a per minute rate. I can expand/explain further if it doesn't fit into your scenario. (Not sure what the "24"'s were for in the formula you found.)

    Let me know if it's what you're looking for...

    Brian
  • Feb 2, 2009, 04:45 PM
    ScottGem

    If you format a cell as time format then it should display in hh:mm format.
  • Feb 2, 2009, 06:08 PM
    JBeaucaire

    Properly formatted as time as Scott suggests gives you the ability to directly add and subtract the cells. Format ALL the requisite cells as hh:mm including the cell that is getting this formula, then you can simply add/subtract:

    =IF(OR(K8="",K7=""),0,IF(K8<K7,K7-K8,K8-K7))
  • Feb 2, 2009, 06:30 PM
    JBeaucaire
    Although, now that I look at what your formula is doing, you do need to take into account the midnight issue. I've fixed that too in the RED section.

    =IF(OR(K8="",K7=""),0,K8-K7+(K7>K8))

    This simple formula assumes all times are represented in 24hr format.

    4:00 - 10:00 = 18hrs with that formula since 4:00 is 4am.
    16:00 - 10:00 = 6hrs as 16 is 4pm
    22:30 - 8:00 = 8:30

    The underlined trick at the end is a simple true/false and will add 24 if true without needing another IF statement.
  • Feb 11, 2009, 12:32 PM
    chris1962

    I just wanted to thank all you guys for the help. Both formulas worked. I usually only do simple formulas in Excel and never time formulas, you have saved me a lot of time and frustration!
  • Feb 11, 2009, 04:05 PM
    JBeaucaire

    Always glad to help. Keep us on speed dial.

  • All times are GMT -7. The time now is 02:47 PM.