Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Subtracting time - if the cell is not blank (https://www.askmehelpdesk.com/showthread.php?t=765706)

  • Sep 4, 2013, 08:14 AM
    Jon_JnP
    Subtracting time - if the cell is not blank
    I'm trying to have a cell tell me the difference in times. We record the start and end time of each job, and it would be handy to have it calculate it for me... currently I have two ways I can think of two do it, one of which works for the most part (just annoys me lol)...

    =TEXT(C9-D8,"h:mm")

    This one works, but if there is an end time, and it's the last run of the day, it gives a bad value for the next one... it works, but the bad value annoys me :-)

    I want something like this to work...

    =IF(OR(ISBLANK(D8),ISBLANK(C9)),"",C9-D8)

    The problem here is that it considers the time as a decimal I think...

    Any thoughts? - Thanks in advance!
  • Sep 5, 2013, 08:02 AM
    JBeaucaire
    If the cell will be EMPTY, then maybe this:

    =IF(COUNT(C8,D9)=2, TEXT(C9-D8,"h:mm"), "")
  • Sep 6, 2013, 09:31 AM
    Jon_JnP
    Works like a charm! You're awesome!

    Thanks a million!
  • Sep 6, 2013, 11:46 AM
    JBeaucaire
    If there's ever a chance the TIMES in those two cells will go past midnight, so you're trying to subtract 1:00am from 11:00pm, the formula would need to be a little longer:

    =IF(COUNT(C8,D9)=2, TEXT(((C9-D8)+(D8>C9)),"h:mm"), "")

  • All times are GMT -7. The time now is 04:16 AM.