Determining # of Week Days between Two Dates

L

LA Lawyer

I want to calculate the difference of WEEK days (not including weekends)
between two dates. How is that done?
 
R

Ron2006

Here is a simple solution (watch word wrap):

1) Compute the number of working days between two dates:

workdays =DateDiff("d",[StartDate],[EndDate])-(DateDiff("ww",
[StartDate],[EndDate
],7)+DateDiff("ww",[StartDate],[EndDate],1)) + 1

The first datediff gives you ALL days, The second datediff gives you
the count of Saturdays. The third datediff gives you the count of
Sundays.

Add one of don't add one to the count depending on whether you want to
count the first AND last day or not.

You now have the total number of weekdays between two dates.

If you want to exclude holidays................
2) Create a table of holidays.

write a query that selects all records in that table between the
specified dates and use

holidaycnt= dCount ("[fieldnameinholidaytable]",
"theabovecreatedquery")

Subtract 2 from1 and you have the actual workdays. (Add 1 to result if
first and last day are to be counted)

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top