Networkdays formula

RattlingCarp3048

Board Regular
Joined
Jan 12, 2022
Messages
202
Office Version
  1. 365
Platform
  1. Windows
=NETWORKDAYS(I3,J3,Lookup!$D$2:$D$4)-1-MOD(I3,1)+MOD(J3,1)

I have 2 columns with date/time stamps and need to caclulate the difference between them minus holidays and weekends but also factor in the time. if i only use the networkdays by default it rounds to the whole day and does not factor in the time. I found the above formula somewhere online. It seems to work pretty well for the vast majority of the rows, however, i have a few that are returning a negative value and im not sure why. Only commonality i can find is that all of the Order Entry dates happen to fall on a saturday.

But why would that return a negative difference? Shouldnt it still be positive? is there another factor i should include in the formula?


Collection Date/TimeOrder Entry Date/TimeColl. To OE
(DAYS)
2/3/23 10:20 AM2/4/23 3:56 AM-0.27
2/17/23 4:57 PM2/18/23 12:28 AM-0.69
2/24/23 6:12 PM2/25/23 2:53 AM-0.64
6/16/23 4:09 PM6/17/23 12:37 AM-0.65
6/16/23 4:06 PM6/17/23 12:41 AM-0.64
6/23/23 5:13 PM6/24/23 12:29 AM-0.70
6/23/23 4:04 PM6/24/23 12:46 AM-0.64
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
So networkdays, will return a 2 for 2 adjacent non-weekend days. And a two for a Friday-Monday. But it only returns a 1 for friday to saturday. Just one work day.

So you are subtracting 1 from 1 (instead of the usual 2). Then you are dealing with the time. So the time in the first day (Column I) is later than the time in the second day (J), so it'll finish negative.

The question might be, if networkdays is good to use, why are there activities that happen on Saturdays? What are the work days? (Networkdays.intl handles variability in the weekends.)
 
Upvote 0
So networkdays, will return a 2 for 2 adjacent non-weekend days. And a two for a Friday-Monday. But it only returns a 1 for friday to saturday. Just one work day.

So you are subtracting 1 from 1 (instead of the usual 2). Then you are dealing with the time. So the time in the first day (Column I) is later than the time in the second day (J), so it'll finish negative.

The question might be, if networkdays is good to use, why are there activities that happen on Saturdays? What are the work days? (Networkdays.intl handles variability in the weekends.)
oh ok, that makes sense. so we have staff that work on the weekends and holidays, however, our leadership only works M-F, no weekends or holidays. so when we are trying to calculate the leaderships turnaround time we need to exclude weekends and holidays becasue they are off but need to include the time we are more precise. Can you think of a better formula that would work?
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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