Help removing NETWORKDAYS function from formula

kern630

New Member
Joined
Feb 21, 2017
Messages
6
Hi, all:

I have been using the formula below to calculate the total hours run time within a certain time range (12:00PM - 8:00PM) for each of our units. This calculates only the hours run within the time range whether the unit ran for one hour or multiple days. The issue I need help with is that the formula only calculates workdays (NETWORKDAYS) and does not include weekends. We are now running our units seven days a week and I need assistance changing the formula to calculate seven days a week. I have been struggling with this for a couple of days now.

A2= START TIME
B2= END TIME
A5= START DATE
B5= END DATE

=IF(OR($B$2<$A$2,B5<A5),0,(NETWORKDAYS(A5,B5)-(NETWORKDAYS(A5,A5)*IF(MOD(A5,1)>$B$2,1,(MAX($A$2,MOD(A5,1))-$A$2)/($B$2-$A$2)))-(NETWORKDAYS(B5,B5)*IF(MOD(B5,1)<$A$2,1,($B$2-MIN($B$2,MOD(B5,1)))/($B$2-$A$2))))*($B$2-$A$2)*24)

Below is an example. The unit ran from Friday at noon until Monday at 9:00PM. The total hours calculated within the time range (12:00pm - 8:00PM) should be 32 but since the formula is not capturing weekend runs I receive a total of 16.

[TABLE="width: 500"]
<tbody>[TR]
[TD]START TIME[/TD]
[TD]END TIME[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12:00 PM[/TD]
[TD]8:00 PM[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]START DATE[/TD]
[TD]END DATE[/TD]
[TD]NET WORK HOURS (DECIMAL)[/TD]
[TD]NET WORK HOURS (H:MM)[/TD]
[/TR]
[TR]
[TD]FRI 11/3/17 12:00 PM[/TD]
[TD]MON 11/6/17 9:00PM[/TD]
[TD]16.00[/TD]
[TD]16:00[/TD]
[/TR]
</tbody>[/TABLE]
 
@BH

Nice to see you back!! :)
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hey Rory!

I only meant to take a break for a month or two and it turned out to be 2 years..... (or is it longer :eeek:)

Anything exciting happen, I heard there was a referendum?
 
Upvote 0
No I don't think anything has changed. Same lunatics running the asylums... :)
 
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,878
Members
452,486
Latest member
standw01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top