PC Review


Reply
Thread Tools Rate Thread

add 4 working days

 
 
news.microsoft.com
Guest
Posts: n/a
 
      7th Jun 2004
Hi,

I have a table of holidays and a date
I want to be able to add 4 working days excl. holidays to the given date

How can I do this?

Thanks


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      7th Jun 2004
See Workday math at:
http://www.mvps.org/access/datetime/date0012.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"news.microsoft.com" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I have a table of holidays and a date
> I want to be able to add 4 working days excl. holidays to the given date



 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      7th Jun 2004
Yes, there is.

You could create your table of holidays, DCount() the number found in the
date range you are interested in, and subtract from the result.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"news.microsoft.com" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thanks for this
> Is there a way so that the function can accept a variable for the Holiday
> dates based on a table of hols.
>
> If yes, how would I go about this?
>
> Thanks
>
> Public Function dhAddWorkDaysA(lngDays As Long, _
> Optional dtmDate As Date = 0, _
> Optional adtmDates As Variant) As
> Dim lngCount As Long
> Dim dtmTemp As Date
>
> If dtmDate = 0 Then
> dtmDate = Date
> End If
>
> dtmTemp = dtmDate
> For lngCount = 1 To lngDays
> dtmTemp = dhNextWorkdayA(dtmTemp, adtmDates)
> Next lngCount dhAddWorkDaysA = dtmTemp
> End Function
> "Allen Browne" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > See Workday math at:
> > http://www.mvps.org/access/datetime/date0012.htm
> >
> > --
> > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > Tips for Access users - http://allenbrowne.com/tips.html
> > Reply to group, rather than allenbrowne at mvps dot org.
> >
> > "news.microsoft.com" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > >
> > > I have a table of holidays and a date
> > > I want to be able to add 4 working days excl. holidays to the given

date
> >
> >

>
>



 
Reply With Quote
 
news.microsoft.com
Guest
Posts: n/a
 
      7th Jun 2004
Thanks for this
Is there a way so that the function can accept a variable for the Holiday
dates based on a table of hols.

If yes, how would I go about this?

Thanks

Public Function dhAddWorkDaysA(lngDays As Long, _
Optional dtmDate As Date = 0, _
Optional adtmDates As Variant) As
Dim lngCount As Long
Dim dtmTemp As Date

If dtmDate = 0 Then
dtmDate = Date
End If

dtmTemp = dtmDate
For lngCount = 1 To lngDays
dtmTemp = dhNextWorkdayA(dtmTemp, adtmDates)
Next lngCount dhAddWorkDaysA = dtmTemp
End Function
"Allen Browne" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> See Workday math at:
> http://www.mvps.org/access/datetime/date0012.htm
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "news.microsoft.com" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >
> > I have a table of holidays and a date
> > I want to be able to add 4 working days excl. holidays to the given date

>
>



 
Reply With Quote
 
news.microsoft.com
Guest
Posts: n/a
 
      7th Jun 2004
Thanks but what I am trying to do is find a date 4 working days from a given
date.
The function that you pointed me to works fine if I hard code all the years
holiday dates - obviously I don't want to do this because they are always
changing.
I can't see how your next suggestion will help
Please explain
Thanks again for your help
"Allen Browne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, there is.
>
> You could create your table of holidays, DCount() the number found in the
> date range you are interested in, and subtract from the result.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
> "news.microsoft.com" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Thanks for this
> > Is there a way so that the function can accept a variable for the

Holiday
> > dates based on a table of hols.
> >
> > If yes, how would I go about this?
> >
> > Thanks
> >
> > Public Function dhAddWorkDaysA(lngDays As Long, _
> > Optional dtmDate As Date = 0, _
> > Optional adtmDates As Variant) As
> > Dim lngCount As Long
> > Dim dtmTemp As Date
> >
> > If dtmDate = 0 Then
> > dtmDate = Date
> > End If
> >
> > dtmTemp = dtmDate
> > For lngCount = 1 To lngDays
> > dtmTemp = dhNextWorkdayA(dtmTemp, adtmDates)
> > Next lngCount dhAddWorkDaysA = dtmTemp
> > End Function
> > "Allen Browne" <(E-Mail Removed)> wrote in message
> > news:#(E-Mail Removed)...
> > > See Workday math at:
> > > http://www.mvps.org/access/datetime/date0012.htm
> > >
> > > --
> > > Allen Browne - Microsoft MVP. Perth, Western Australia.
> > > Tips for Access users - http://allenbrowne.com/tips.html
> > > Reply to group, rather than allenbrowne at mvps dot org.
> > >
> > > "news.microsoft.com" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > >
> > > > I have a table of holidays and a date
> > > > I want to be able to add 4 working days excl. holidays to the given

> date
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating time difference using working days and working times Kevo Microsoft Access 6 1st May 2009 02:06 AM
Calculate working days but change working week SamB Microsoft Excel Misc 1 1st Sep 2008 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Microsoft Excel Misc 1 30th May 2008 10:02 PM
How to calculation no. of days (only working days) between two dat =?Utf-8?B?Vml2aWFuIENoYW4=?= Microsoft Excel Misc 1 26th Jul 2007 09:16 AM
Business Days Or Working Days Date-less Microsoft Excel Worksheet Functions 1 16th Apr 2004 10:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:22 PM.