ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Networkdays function (https://www.excelbanter.com/excel-worksheet-functions/150100-networkdays-function.html)

jeanmac

Networkdays function
 
Hi, I've been using the Networkdays function to work out the date 7 days
previous to today minus working days. I'm doing it in two stages, eg cell A1
= today(), cell A2 = 7, cell A3 = A1-A2, Cell A4 = Networkdays(A3, A1).
However, it comes back with the answer 6 when I would expect to see 5. Does
anyone know why that should happen? Also is there a quicker way of doing
this? Help would be much appreciated. Thanks. Jean

Mike H

Networkdays function
 
Hi,

I'm not surprised you get 6 because networkdays includes the start and end
date.

For example there are 5 network days between 1/1/2007 and 5/1/2007

so in your case going back 7 days from today takes us to 6/7/2007 which is
last Friday and Friday to Friday is 6 network days.

An easier way
=NETWORKDAYS(TODAY()-7,TODAY())

Mike



"jeanmac" wrote:

Hi, I've been using the Networkdays function to work out the date 7 days
previous to today minus working days. I'm doing it in two stages, eg cell A1
= today(), cell A2 = 7, cell A3 = A1-A2, Cell A4 = Networkdays(A3, A1).
However, it comes back with the answer 6 when I would expect to see 5. Does
anyone know why that should happen? Also is there a quicker way of doing
this? Help would be much appreciated. Thanks. Jean


Bob Phillips

Networkdays function
 
If you want to exclude the start date us

=NETWORKDAYS(A3,A1)-(WEEKDAY(A3,2)<=5)

or

=NETWORKDAYS(A3,A1)-(WEEKDAY(A1,2)<=5)

to exclude the end date

The test is so as not to exclude if the day is a weekend as NETWORKDAYS
wouldn't have counted it anyway

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"jeanmac" wrote in message
...
Hi, I've been using the Networkdays function to work out the date 7 days
previous to today minus working days. I'm doing it in two stages, eg cell
A1
= today(), cell A2 = 7, cell A3 = A1-A2, Cell A4 = Networkdays(A3, A1).
However, it comes back with the answer 6 when I would expect to see 5.
Does
anyone know why that should happen? Also is there a quicker way of doing
this? Help would be much appreciated. Thanks. Jean




aehan

Networkdays function
 
Thanks to both Mike and Bob for your help. I couldn't find anywhere that
Networkdays included the start and end date, it wasn't clear in the help.
Also thanks for the much better way of writing it.

Jean

"Bob Phillips" wrote:

If you want to exclude the start date us

=NETWORKDAYS(A3,A1)-(WEEKDAY(A3,2)<=5)

or

=NETWORKDAYS(A3,A1)-(WEEKDAY(A1,2)<=5)

to exclude the end date

The test is so as not to exclude if the day is a weekend as NETWORKDAYS
wouldn't have counted it anyway

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"jeanmac" wrote in message
...
Hi, I've been using the Networkdays function to work out the date 7 days
previous to today minus working days. I'm doing it in two stages, eg cell
A1
= today(), cell A2 = 7, cell A3 = A1-A2, Cell A4 = Networkdays(A3, A1).
However, it comes back with the answer 6 when I would expect to see 5.
Does
anyone know why that should happen? Also is there a quicker way of doing
this? Help would be much appreciated. Thanks. Jean






All times are GMT +1. The time now is 05:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com