I'm trying to calculate elapsed time in hours from a start date/time to an end date/time.
Work hours are M-F, 6AM - 6PM.
Below is the formula I'm using.
=(NETWORKDAYS(B3,C3)-1)*("18:00"-"6:00")+MOD(C3,1)-MOD(B3,1)
The problem I'm having is if the start day is after business hours or on Saturday or Sunday, The hours don't calculate correctly.
I need your help with a formula correction that will resolve the scenarios below in RED
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]Elapsed Time[/TD]
[TD]Comment[/TD]
[TD]Correct Value[/TD]
[/TR]
[TR]
[TD][TABLE="width: 110"]
<tbody>[TR="class: grid"]
[TD="width: 110"]8/17/19 15:30 (Sun)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 101"]
<tbody>[TR="class: grid"]
[TD="width: 101"]8/19/19 17:30 (Mon)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]2:00[/TD]
[TD]Incorrect value[/TD]
[TD]11:30 hrs[/TD]
[/TR]
[TR]
[TD][TABLE="width: 110"]
<tbody>[TR="class: grid"]
[TD="width: 110"]8/14/19 18:30 (Wed)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 101"]
<tbody>[TR="class: grid"]
[TD="width: 101"]8/15/19 17:30 (Thu)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]11:00[/TD]
[TD]Incorrect Value[/TD]
[TD]11:30 hrs[/TD]
[/TR]
[TR]
[TD][TABLE="width: 110"]
<tbody>[TR="class: grid"]
[TD="width: 110"]8/14/19 7:00 (Wed)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 101"]
<tbody>[TR="class: grid"]
[TD="width: 101"]8/16/19 13:00 (Fri)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]30:00[/TD]
[TD]Correct[/TD]
[TD]30:00 hrs[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks much for your assistance in advance.
Work hours are M-F, 6AM - 6PM.
Below is the formula I'm using.
=(NETWORKDAYS(B3,C3)-1)*("18:00"-"6:00")+MOD(C3,1)-MOD(B3,1)
The problem I'm having is if the start day is after business hours or on Saturday or Sunday, The hours don't calculate correctly.
I need your help with a formula correction that will resolve the scenarios below in RED
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]Elapsed Time[/TD]
[TD]Comment[/TD]
[TD]Correct Value[/TD]
[/TR]
[TR]
[TD][TABLE="width: 110"]
<tbody>[TR="class: grid"]
[TD="width: 110"]8/17/19 15:30 (Sun)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 101"]
<tbody>[TR="class: grid"]
[TD="width: 101"]8/19/19 17:30 (Mon)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]2:00[/TD]
[TD]Incorrect value[/TD]
[TD]11:30 hrs[/TD]
[/TR]
[TR]
[TD][TABLE="width: 110"]
<tbody>[TR="class: grid"]
[TD="width: 110"]8/14/19 18:30 (Wed)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 101"]
<tbody>[TR="class: grid"]
[TD="width: 101"]8/15/19 17:30 (Thu)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]11:00[/TD]
[TD]Incorrect Value[/TD]
[TD]11:30 hrs[/TD]
[/TR]
[TR]
[TD][TABLE="width: 110"]
<tbody>[TR="class: grid"]
[TD="width: 110"]8/14/19 7:00 (Wed)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 101"]
<tbody>[TR="class: grid"]
[TD="width: 101"]8/16/19 13:00 (Fri)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]30:00[/TD]
[TD]Correct[/TD]
[TD]30:00 hrs[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks much for your assistance in advance.