calculate end date using start date and number of specific weekdays

freekystyley

New Member
Joined
Nov 12, 2008
Messages
4
<HR style="COLOR: #d1d1e1; BACKGROUND-COLOR: #d1d1e1" SIZE=1> <!-- / icon and title --><!-- message -->
Hello,

I am teaching a class that requires students to attend a total of 24 times - classes are held on mondays and wednesdays.

What I want to do is input the student's start date and have a formula return an end date based on that student attending 24 classes.

I want to have several cells in the excel sheet for each student - example:
A1 = Start Date
B1 = Today's Date

C1 = 24 (number of classes they have to attend)
D1 = number of classes they have attended
E1 = SUM(B1-C1) = number of classes remaining

F1 = End date based on today's date + the number of classes remaining (which are held on mondays and wednesdays only)

The information in F1 would need to update itself based on the information in E1 - leaving me the ability to change the data in D1 each time the student is present for class.

I realize this is a bit complicated - i'm just totally lost on how to lay this out...

So far I've been able to come up with the following code to determine the number of Mondays and Wednesdays between two specific dates, but that's not exactly what I'm after.


Code:
=SUM(INT((WEEKDAY(A1-{1,4,5,6,7})-A1+B1)/7))
where 1=sunday, 2=monday, etc. in the array
and A1=start date
and B1=end date
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hello freekystyley, welcome to MrExcel,

I assume E1 should be C1-D1

Then assuming you have already taken into account all classes attended up to and including today you could use this formula in F1 for end date

=SMALL(IF(ABS(WEEKDAY(B1+ROW(INDIRECT("1:"&E1*5)))-3)=1,ROW(INDIRECT("1:"&E1*5))),E1)+B1

This is an array formula that needs to be confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
One more simple question, I hope - I'm attempting to understand this formula as well as I can - what data in the formula would need to change if, say, the class were moved from Monday/Wednesday to Tues/Thurs?

Thanks again


Hello freekystyley, welcome to MrExcel,

I assume E1 should be C1-D1

Then assuming you have already taken into account all classes attended up to and including today you could use this formula in F1 for end date

=SMALL(IF(ABS(WEEKDAY(B1+ROW(INDIRECT("1:"&E1*5)))-3)=1,ROW(INDIRECT("1:"&E1*5))),E1)+B1

This is an array formula that needs to be confirmed with CTRL+SHIFT+ENTER
 
Upvote 0
I needlessly made the formula a lttle more complex than it should be, and in the process also made it less transparent. You can use this version

=SMALL(IF(WEEKDAY(B1+ROW(INDIRECT("1:"&E1*5)))={2,4},ROW(INDIRECT("1:"&E1*5))),E1)+B1

where the {2,4} represent the days on which there are classes, i.e. Mondays and Wednesdays, so if you wanted to change to Tuesdays and Thursdays that would become {3,5}

Note: the *5 part represents the maximum number of days between the dates (Wednesday to Monday is 5) so if that changes, for instance if you have classes on Tuesday and wednesday change the two instances of *5 to *6.....or *7 should accommodate any combination of days, or single days
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,378
Messages
6,124,603
Members
449,174
Latest member
ExcelfromGermany

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