finding first MWF of week

Skrej

Board Regular
Joined
May 31, 2013
Messages
159
Office Version
  1. 365
Platform
  1. Windows
I'm trying to figure out a formula for an attendance roster that will calculate the first M/W/F of a month. Since this particular class only meets M/W/F, I'd like to generate an attendance roster that for each month (each month on separate sheet) which finds the first day of the month that's either a M/W/F, then calculate all the subsequent M/W/F days, skipping over weekends, etc. The in the row above, calculate which day of the week that date is

Here's a partially completed example of what September 2019 would look like:

MonWedFridayMonWedFridayMonWedFri
9/29/49/69/99/119/139/169/189/20

<tbody>
</tbody>

I've been playing with some formulas I've googled, but can't quite seem to get them pieced together.

thanks in advance
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What would the full row for October 2019 look like?
 
Last edited:
Upvote 0
...finds the first day of the month that's either a M/W/F,
The following array-entered** formula should give you the date of the first day of the month that is either a Monday, Wednesday or Friday...

=MIN(DATE(A1,B1,8)-WEEKDAY(DATE(A1,B1,8-{2,4,6})))

**Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.
 
Last edited:
Upvote 0
Let's assume you have a date (say, 9/1/2019), in cell A1.

Put the following formula in cell A4 and drag-copy it until you reach cell N4:

=IF(ISERR(1/(MIN(WORKDAY.INTL(EOMONTH($A$1,-1),COLUMNS($A$1:A1),{"0111111","0101111","0101011"}))<=EOMONTH($A$1,0))),"",MIN(WORKDAY.INTL(EOMONTH($A$1,-1),COLUMNS($A$1:A1),{"0111111","0101111","0101011"})))

Custom-format the fourteen cells with the formulas as m/d

Then, put the following formula in cell A3 and drag-copy it until you reach cell N3:

=TEXT(A4,"ddd")
 
Last edited:
Upvote 0
Update: here is a simpler formula for cell A4:

=IF(MIN(WORKDAY.INTL(EOMONTH($A$1,-1),COLUMNS($A$1:A1),{"0111111","0101111","0101011"}))>EOMONTH($A$1,0),"",MIN(WORKDAY.INTL(EOMONTH($A$1,-1),COLUMNS($A$1:A1),{"0111111","0101111","0101011"})))
 
Upvote 0
Another option to consider

Fist of month in A2
B1 copied across to O1
B2 stand-alone formula
C2 copied across to O2

Excel Workbook
ABCDEFGHIJKLMNO
1WedFriMonWedFriMonWedFriMonWedFriMonWed
21/10/20192-Oct-194-Oct-197-Oct-199-Oct-1911-Oct-1914-Oct-1916-Oct-1918-Oct-1921-Oct-1923-Oct-1925-Oct-1928-Oct-1930-Oct-19
List MWF



If you want to be able to put ANY date in A2, then just change B2 to

Code:
=A2-DAY(A2)+1+AGGREGATE(15,6,7-WEEKDAY(A2-DAY(A2)+2+{2,4,6}),1)
 
Last edited:
Upvote 0
What would the full row for October 2019 look like?

It would look like this (if I've read my calendar correctly...)

Wed
Fri
Mon
Wed
Fri
Mon
Wed
Fri
Mon
Wed
Fri
Mon
Wed
10/2
10/4
10/7
10/9
10/11
10/14
10/16
10/18
10/21
10/23
10/25
10/28
10/30

<tbody>
</tbody>
 
Upvote 0
The following array-entered** formula should give you the date of the first day of the month that is either a Monday, Wednesday or Friday...

=MIN(DATE(A1,B1,8)-WEEKDAY(DATE(A1,B1,8-{2,4,6})))

**Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself.

I'm guessing I need a date in A1, but what would be in B1?
 
Upvote 0
Update: here is a simpler formula for cell A4:

=IF(MIN(WORKDAY.INTL(EOMONTH($A$1,-1),COLUMNS($A$1:A1),{"0111111","0101111","0101011"}))>EOMONTH($A$1,0),"",MIN(WORKDAY.INTL(EOMONTH($A$1,-1),COLUMNS($A$1:A1),{"0111111","0101111","0101011"})))

Thanks, this does the trick. However, I can't follow what's going on. Could you (or somebody else) sort of step through it, so I can see how to modify it for future use? For example, modify it for Tue/Thu classes. I'm guessing some of those binary looking numbers represent the days of the week.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top