Discussion Locked

MS Access--Weekend function?

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Is there a MS Access formula that allows me to skip weekend days?

I am creating an Employee Leave table in Access. Some of the fields are StartDate and EndDate. I would like a third field called TotalDaysOut that would calculate how many days the employee was out, but exclude Saturdays and Sundays.

I will check back frequently for answers. Please let me know if you need more info.

6 replies

by mbarker734

The below function will work for you PROVIDED the dates entered are only weekdays Monday thru Friday. Inputing a start or end date that is either a Saturday or Sunday will produce undesired results.

((DateDiff("d",[Start_Date],[End_date]))-((Int((DateDiff("d",[Start_Date],[End_date])/7)+0.5))*2))

Hope this helped some,

Mark

by mbarker734

If you have the dates submitted to you as:

First weekday date you will be off:

Weekday date you will return:

The above works.

Good luck,

Mark

by ldassow

This function is included in the Analysis ToolPak add-in macro. This can be obtained off of your office cd or from the microsoft website. The macro you will be working with is called NETWORKDAYS or you can use the macro called WORKDAY. I hope this helps.

This discussion is closed to new replies.