473,836 Members | 1,438 Online

# How to find out the number of Mondays in a month?

379 Contributor
I need to count the number of each weekday in a month (# of Mondays, # of Tuesdays, etc.). Is this even possible in Access?

Let me see if I can explain the reason I need these 5 counts.

In our Operating Room, the time is allocated to different classes of surgeries (General, Neurology, Pediatrics, etc.), and we want to compare the actual minutes spent in each category with what was allocated, and the allocations are made per day-of-the-week.

Complicating the issue is that different amounts are allocated on different weekdays; for instance, General surgeries are allocated 450 minutes a day, except that it's allocated only 420 minutes on Mondays. Ob-Gyn is allocated 450 minutes on Tuesdays and Wednesdays, and Plastics is allocated 240 minutes on Tuesdays and Fridays, and 450 minutes on Thursdays. You get the idea.

So I can calculate the correct "monthly" allocation only if I can figure out how many of each weekday occurs in a given month.

Any advice will be appreciated, even including "can't be done in Access". However, if that's the answer, I'll be most grateful for tips about how to accomplish this "outside" in such a way that I can use the results within Access.

Thanks!
Mar 21 '11
11 11534
sueb
379 Contributor
@Gershwyn: that's lovely--very elegant. Okay, I'll try out these options and post back here which one I end up using.
Mar 21 '11 #11
sueb
379 Contributor
Okay, I'm going with NeoPa's code for now (although I saved Gershwyn's off because I think I'll need it for another project later).

I now have more questions about how to accomplish my final goal of comparing "actual" with "allocated" minutes, but I'll ask those in other threads.

Thanks, everyone!
Mar 22 '11 #12