JenkinsM82
New Member
- Joined
- May 17, 2018
- Messages
- 9
I'm trying to create a formula that will calculate the number of business hours between two date/times. The start of business hours is 8:00 am and the end is 5:00 pm. Plus, I need to take holidays into consideration. In these examples, 1/2/2023 is in the "Holidays" list.
Here is the formula I'm using:
=(NETWORKDAYS.INTL(A1, B1, "0000000", Holidays)-1) * 9 + MAX(MIN(MOD(B1,1), TIMEVALUE("17:00")) - MAX(MOD(A1,1), TIMEVALUE("08:00")), 0) * 24
This formula works for examples A and B but example C results in 0 and example D results in 9.
Anyone have any ideas on how to fix this?
Example | Start Time (A1) | End Time (B1) | # of Hours |
---|---|---|---|
A | 1/4/2023 1:30:00 PM | 1/6/2023 3:30:00 PM | 20.00 |
B | 1/2/2023 5:06:00 AM | 1/3/2023 9:00:00 AM | 1.00 |
C | 1/2/2023 9:18:00 AM | 1/3/2023 8:19:00 AM | 0.32 |
D | 1/3/2023 10:00:00 AM | 1/4/2023 9:00:00 AM | 8.00 |
=(NETWORKDAYS.INTL(A1, B1, "0000000", Holidays)-1) * 9 + MAX(MIN(MOD(B1,1), TIMEVALUE("17:00")) - MAX(MOD(A1,1), TIMEVALUE("08:00")), 0) * 24
This formula works for examples A and B but example C results in 0 and example D results in 9.
Anyone have any ideas on how to fix this?