Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default count work days


I need a way of counting workdays between two dates. i can do it using the
NETWORKDAYS function but I know that not everyone has the add ons turned on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default count work days

On 1 jul, 20:17, "Darrell_Sarrasin via OfficeKB.com" <u33691@uwe
wrote:
I need a way of counting workdays between two dates. *i can do it using the
NETWORKDAYS function but I know that not everyone has the add ons turned on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted viahttp://www.officekb.com


Hi Darrell,

I have had the same problem in the past using Excel 2003.

I created this combo of functions:

Function isWeekend(aDate As Date) As Boolean

If Weekday(aDate, vbSunday) = vbSunday Or Weekday(aDate, vbSunday)
= vbSaturday Then
isWeekend = True
Else
isWeekend = False
End If
End Function

Function countWorkdates(datFrom As Date, datUpto As Date) As Integer
Application.Volatile
Dim intCount As Integer
Dim datLoop As Date
'
For datLoop = datFrom To datUpto
If Not isWeekend(datLoop) Then intCount = intCount + 1
Next
countWorkdates = intCount
End Function

HTH,

Wouter
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default count work days

B1 contains 6/10/2009
C1 contains 7/1/2009

D1 contains the formula

=CEILING((C1-B1)-(((C1-B1)/7)*2),1)

This returns the value 15, which is the number of weekdays between the
two dates.

HTH,
JP

On Jul 1, 2:17*pm, "Darrell_Sarrasin via OfficeKB.com" <u33691@uwe
wrote:
I need a way of counting workdays between two dates. *i can do it using the
NETWORKDAYS function but I know that not everyone has the add ons turned on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted viahttp://www.officekb.com


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default count work days


Hi,

You can do it with Sumproduct and weekday which isn't part of ATP like this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6))

and if you want to include holidays try this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6),--(ISNA(MATCH(ROW(INDIRECT(A1&":"&B1)),C1:C8,0))))

Where your holidays are in c1 - c8

Mike

"Darrell_Sarrasin via OfficeKB.com" wrote:

I need a way of counting workdays between two dates. i can do it using the
NETWORKDAYS function but I know that not everyone has the add ons turned on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted via http://www.officekb.com


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default count work days


If someone enter a weekend date as a holiday, that will deduct 1 for that
date as well.

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Hi,

You can do it with Sumproduct and weekday which isn't part of ATP like
this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6))

and if you want to include holidays try this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6),--(ISNA(MATCH(ROW(INDIRECT(A1&":"&B1)),C1:C8,0))))

Where your holidays are in c1 - c8

Mike

"Darrell_Sarrasin via OfficeKB.com" wrote:

I need a way of counting workdays between two dates. i can do it using
the
NETWORKDAYS function but I know that not everyone has the add ons turned
on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted via http://www.officekb.com






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default count work days


Bob,

I know, do you know how to eliminate that problem?

Mike

"Bob Phillips" wrote:

If someone enter a weekend date as a holiday, that will deduct 1 for that
date as well.

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Hi,

You can do it with Sumproduct and weekday which isn't part of ATP like
this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6))

and if you want to include holidays try this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6),--(ISNA(MATCH(ROW(INDIRECT(A1&":"&B1)),C1:C8,0))))

Where your holidays are in c1 - c8

Mike

"Darrell_Sarrasin via OfficeKB.com" wrote:

I need a way of counting workdays between two dates. i can do it using
the
NETWORKDAYS function but I know that not everyone has the add ons turned
on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted via http://www.officekb.com





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default count work days


Bob,

I think I agreed with you a bit too quickly. Take the dates 20/12/2009 -
31/12/2009
and 4 holiday dates 26/12, 27/12,28/12 & 21/12 in c1 - C4. Sumproduct
produces these 2 arrays. Because Sat and Sun are already evaluting as FALSE
the second array is irrelevent and only becomes relevant if the first array
evalueates as TRUE which it never will for a weekend date. The same as
networkdays (7 in this case) or am I missing something?

20/12/2009 0 1
21/12/2009 1 0
22/12/2009 1 1
23/12/2009 1 1
24/12/2009 1 1
25/12/2009 1 1
26/12/2009 0 0
27/12/2009 0 0
28/12/2009 1 0
29/12/2009 1 1
30/12/2009 1 1
31/12/2009 1 1

Mike

"Mike H" wrote:

Bob,

I know, do you know how to eliminate that problem?

Mike

"Bob Phillips" wrote:

If someone enter a weekend date as a holiday, that will deduct 1 for that
date as well.

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Hi,

You can do it with Sumproduct and weekday which isn't part of ATP like
this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6))

and if you want to include holidays try this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6),--(ISNA(MATCH(ROW(INDIRECT(A1&":"&B1)),C1:C8,0))))

Where your holidays are in c1 - c8

Mike

"Darrell_Sarrasin via OfficeKB.com" wrote:

I need a way of counting workdays between two dates. i can do it using
the
NETWORKDAYS function but I know that not everyone has the add ons turned
on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted via http://www.officekb.com





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default count work days


I think you are right Mike. My standard formula for that is a lot longer, I
assumed there was a reason for that. I tested yours thinking it must have
constraints, but it must have been rubbish testing as on re-checking your
formula seems fine. My apologies.

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Bob,

I think I agreed with you a bit too quickly. Take the dates 20/12/2009 -
31/12/2009
and 4 holiday dates 26/12, 27/12,28/12 & 21/12 in c1 - C4. Sumproduct
produces these 2 arrays. Because Sat and Sun are already evaluting as
FALSE
the second array is irrelevent and only becomes relevant if the first
array
evalueates as TRUE which it never will for a weekend date. The same as
networkdays (7 in this case) or am I missing something?

20/12/2009 0 1
21/12/2009 1 0
22/12/2009 1 1
23/12/2009 1 1
24/12/2009 1 1
25/12/2009 1 1
26/12/2009 0 0
27/12/2009 0 0
28/12/2009 1 0
29/12/2009 1 1
30/12/2009 1 1
31/12/2009 1 1

Mike

"Mike H" wrote:

Bob,

I know, do you know how to eliminate that problem?

Mike

"Bob Phillips" wrote:

If someone enter a weekend date as a holiday, that will deduct 1 for
that
date as well.

--
__________________________________
HTH

Bob

"Mike H" wrote in message
...
Hi,

You can do it with Sumproduct and weekday which isn't part of ATP
like
this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6))

and if you want to include holidays try this

=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)),2)<6),--(ISNA(MATCH(ROW(INDIRECT(A1&":"&B1)),C1:C8,0))))

Where your holidays are in c1 - c8

Mike

"Darrell_Sarrasin via OfficeKB.com" wrote:

I need a way of counting workdays between two dates. i can do it
using
the
NETWORKDAYS function but I know that not everyone has the add ons
turned
on
so its pointless as 100 people will be viewing this.

Any Help is greatly appreciated.

--
Message posted via http://www.officekb.com







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count distinct days from two groups of days Colin Excel Worksheet Functions 4 February 17th 10 07:14 PM
When word says Install I want it count the days for 3 days w.o wee CYNTHIA Excel Worksheet Functions 1 March 23rd 08 05:28 AM
count work days excluding Fridays and Saturdays ??? Excel Dubai Excel Worksheet Functions 3 February 17th 07 11:38 AM
COUNT how many ROWS ago out of 10 days that the highest high in 10 days was made rhhince Excel Worksheet Functions 1 January 14th 07 09:56 PM
How do you count work days excluding weekends and holidays? Hausma Excel Discussion (Misc queries) 2 April 8th 05 07:39 PM


All times are GMT +1. The time now is 03:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"