How do I count the number of business days between two dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know that there are a number of formulas to do this calculation, but I am
getting quite confused.

I need to perform this calculation in a query:

Currently my formula is DateDiff("d",[DateReceived],[DateClosed]) and I get
the right result for the number of calendar days but I need to get the number
of working days excluding weekends.

Thanks
 
Mazzara said:
I know that there are a number of formulas to do this calculation, but I am
getting quite confused.

I need to perform this calculation in a query:

Currently my formula is DateDiff("d",[DateReceived],[DateClosed]) and I get
the right result for the number of calendar days but I need to get the number
of working days excluding weekends.

Thanks

It is my guess that Douglas' code will do what you want. I offer the
following as an alternative:

http://groups.google.com/group/comp.databases.ms-access/msg/548d33651b087c05

James A. Fortune
(e-mail address removed)
 
Hi Douglas

I have had a look and copied your module across but I am still getting
errors. If you could provide further assistance that would be fantastic.

Currently I have the two date fields DateReceived and DateClosed. I have
the following in the field of query design.

ReceivedDays: (DateDiff("d",[datereceived],[dateclosed]))

How do I now apply the calculation of business days?



In my querie I have

Douglas J. Steele said:
Take a look in the Date/Time section of "The Access Web"
http://www.mvps.org/access/, or at my September, 2004 "Access Answers"
column in Pinnacle Publication's "Smart Access".

You can download the column (and sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Mazzara said:
I know that there are a number of formulas to do this calculation, but I am
getting quite confused.

I need to perform this calculation in a query:

Currently my formula is DateDiff("d",[DateReceived],[DateClosed]) and I
get
the right result for the number of calendar days but I need to get the
number
of working days excluding weekends.

Thanks
 
If you've copied the module into your application, you can use

ReceivedDays: WorkDayDiff([datereceived],[dateclosed])

If you haven't copied the module, you can use:

ReceivedDays: DateDiff("d", [datereceived], [dateclosed]) - DateDiff("ww",
[datereceived], [dateclosed], 1) * 2 - IIf(Weekday([dateclosed], 1) = 7,
IIf(Weekday([datereceived], 1) = 7, 0, 1), IIf(Weekday([datereceived], 1) =
7, -1, 0))

(where's that supposed to be all one line!)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Mazzara said:
Hi Douglas

I have had a look and copied your module across but I am still getting
errors. If you could provide further assistance that would be fantastic.

Currently I have the two date fields DateReceived and DateClosed. I have
the following in the field of query design.

ReceivedDays: (DateDiff("d",[datereceived],[dateclosed]))

How do I now apply the calculation of business days?



In my querie I have

Douglas J. Steele said:
Take a look in the Date/Time section of "The Access Web"
http://www.mvps.org/access/, or at my September, 2004 "Access Answers"
column in Pinnacle Publication's "Smart Access".

You can download the column (and sample database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Mazzara said:
I know that there are a number of formulas to do this calculation, but I am
getting quite confused.

I need to perform this calculation in a query:

Currently my formula is DateDiff("d",[DateReceived],[DateClosed]) and I
get
the right result for the number of calendar days but I need to get the
number
of working days excluding weekends.

Thanks
 

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

Back
Top