How to count Wednesdays between two dates

Hi there. Does anybody know how to calculate the number of Wednesdays or of specific weekdays between two dates using Numbers. I am a private English teacher and I would like to calculate the number of classes I would give to a certain student based on his/her schedule. I would appreciate any thoughts. Thanks again.

Mac mini (Late 2012), iOS 12.0.1

Posted on Oct 20, 2018 6:53 PM

Reply
7 replies

Oct 21, 2018 4:16 AM in response to JMAURICIOENGLISH

Hi J'


This method creates a calendar that extends from the start date to beyond the end date, then uses COUNTIFS to count a specified weekday between those dates.

User uploaded file

In the Data Entry table, enter Start Date, End Date and Weekday.

Weekday could be a Pop-Up Menu.


In the Calendar table,

formula in A2 =Data Entry::B1

formula in A3 (and Fill Down) =A2+1

Formula in B2 (and Fill Down) =DAYNAME(WEEKDAY(A2))

(This assumes that Sunday is Day 1 of the week)


User uploaded file

Formula in B1 of the Count table =COUNTIFS(Calendar::A,">="&Data Entry::B$1,Calendar::A,"<="&Data Entry::B$2,Calendar::B,"="&Data Entry::B$3)


A quick look at the bottom of the Calendar table to make sure we have sufficient rows to span the start and end dates (I used 1 school term plus a bit):

User uploaded file

All good. Sufficient rows to include the end date!

You may want to give the Calendar table extra rows. 366 rows (1 year) should do it!


For a neater appearance, move (cut and paste) the Calendar table to another Sheet. The formulas will still work.

User uploaded file

Regards,

Ian.

Oct 21, 2018 10:33 AM in response to JMAURICIOENGLISH

Ian's approach is easier to understand. But if you don't mind fooling around with slightly longer formulas it turns out you can also accomplish this in Numbers with one formula in one cell.


User uploaded file


=INT(DUR2DAYS((WEEKDAY(A2−3)+B2−A2))/7)


For different days of the week, you need to change the A2-3 part.


Sunday A2-1

Monday A2-2

Tuesday A2-3

Wednesday A2-4

etc.


Or you can just use this formula, which will look at the day of the week in C1 and make the appropriate adjustment automatically:


User uploaded file


=INT(DUR2DAYS((WEEKDAY(A2−MATCH(C$1,{"Sunday";"Monday";"Tuesday";"Wednesday";"Th ursday";"Friday";"Saturday"},0))+B2−A2))÷7)


SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to count Wednesdays between two dates

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.