Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / February 2007

Tip: Looking for answers? Try searching our database.

Calculate Work Days between Dates?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AndreaM - 29 Jan 2007 22:10 GMT
I have successfully implemented S.Y.M. Wong-a-Ton's calculation of the
difference between two dates that can be found here:
http://enterprise-solutions.swits.net/infopath2003/article.php?t=datediff-vbscri
pt-infopath&c=infopath2003


I was wondering if there is a way to adapt this (or do something different)
so that is shows the number of work days (instead of calendar days)? Like the
NETWORKDAYS function in Excel. I'm not much with VBScript, so samples and/or
examples would be great!
S.Y.M. Wong-A-Ton - 01 Feb 2007 07:54 GMT
You need to look into using the Weekday function (see
http://msdn2.microsoft.com/en-us/library/t51x9wtx.aspx) to detect and count
which days within the period of days were week days.

One way to do this is as follows: Once you've calculated how many days there
are between the two dates, begin at the start date and loop through all the
days one by one. Use the DateAdd function to increment the date everytime by
1 day, and check whether that day was a week day by using the Weekday
function. If it was, increment a counter that tracks how many week days there
were between the two dates.

Unfortunately, I do not have any code for this.
---
S.Y.M. Wong-A-Ton

> I have successfully implemented S.Y.M. Wong-a-Ton's calculation of the
> difference between two dates that can be found here:
[quoted text clipped - 4 lines]
> NETWORKDAYS function in Excel. I'm not much with VBScript, so samples and/or
> examples would be great!
S.Y.M. Wong-A-Ton - 05 Feb 2007 08:25 GMT
I just posted an article that should help you a bit with this issue. See
http://enterprise-solutions.swits.net/infopath2003/article.php?t=calculate-work-
days-between-two-date-pickers-infopath-vbscript&c=infopath2003

---
S.Y.M. Wong-A-Ton

> I have successfully implemented S.Y.M. Wong-a-Ton's calculation of the
> difference between two dates that can be found here:
[quoted text clipped - 4 lines]
> NETWORKDAYS function in Excel. I'm not much with VBScript, so samples and/or
> examples would be great!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.