Search code examples
excel-formulaexcel-2007

Excel calculate SLA between dates for a 24 hour workday


I have the following formula that calculates the work hours between two dates with timestamps. However, the formula returns incorrect results based on my manual calculation.

The data is as follows: Cell D2 = 1/11/2018 7:00:00 PM Cell H2 = 1/15/2018 9:00:00 PM

My formula returns 46.00 hours rather than 32.00 hours.

=24*(NETWORKDAYS(D2,H2)-1)-24*((MOD(H2,1)-MOD(D2,1)))

I feel its something simple that i am missing and appreciate the help anyone can offer.


Solution

  • The data is as follows: Cell D2 = 1/11/2018 7:00:00 PM Cell H2 = 1/15/2018 9:00:00 PM

    try,

    =24*NETWORKDAYS(D2,H2)-24*((1-MOD(H2,1))+(MOD(D2,1)))
    

    result: 50

    5 hrs Thu, 11-Jan-2018
    24 hrs Fri, 12-Jan-2018
    21 hrs Mon, 15-Jan-2018

    I don't know how you expected 32 hrs nor how you plan to deal with weekend or holidays on the start or stop dates.