Excel 计算 24 小时工作日日期之间的 SLA

Excel calculate SLA between dates for a 24 hour workday

我有以下公式计算带有时间戳的两个日期之间的工作时间。但是,根据我的手动计算,公式 returns 的结果不正确。

数据如下: 单元格 D2 = 1/11/2018 7:00:00 下午 单元格 H2 = 1/15/2018 9:00:00 下午

我的公式 returns 46.00 小时而不是 32.00 小时。

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

我觉得我缺少的是一些简单的东西,感谢任何人可以提供的帮助。

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

尝试,

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

结果:50

2018 年 1 月 11 日星期四 5 小时
2018 年 1 月 12 日星期五 24 小时
2018 年 1 月 15 日星期一 21 小时

我不知道你如何预计 32 小时,也不知道你打算如何处理开始或结束日期的周末或假期。

另一种方法是:

=(24*NETWORKDAYS(D2,H2))-HOUR(D2)-(24-HOUR(H2))

(24*NETWORKDAYS(D2,H2)) gets you the number of work days between two dates and multiplies by 24 to give you the number of hours. In this case 72

-HOUR(D2) this subtracts the number of hours from the start date since they will not be part of your worked hours. In this case -19 hours

-(24-HOUR(H2)) this subtracts the remaining hours from the last day since they are after the worked hours. In this case -3 hours