dategoogle-sheetsgoogle-sheets-formuladurationhour

Trying to SUM working hours after midnight


I have this formula:

=ROUNDDOWN(((B1-A1)*24) ; 1)

which calculates the duration between two times (B1=end time, A1=start time) and then converts it to decimal.

The current problem I have with this formula is that it is unable to give a correct answer when the end time is past midnight.

How can I improve the formula to make it work when the end time is past midnight?


Solution

  • Please try the following for a list of dates

    =INDEX(ROUNDDOWN(((B2:B6-A2:A6+(B2:B6<A2:A6))*24) ; 1))
    

    (Do adjust the formula according to your ranges and locale)

    enter image description here