Course Title and Date Range

TerryE123

New Member
Joined
Oct 29, 2016
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hi
I have a list of course titles and dates (courses range from half a day to 25 days) on a tab and runs for a full year
On another tab, I have a row of dates on Row 1 and Column A is a drop down list of trainers.
What I want to do it the calendar to add those courses, one per row, and colour them but also add the names of those courses to the relevant cells
So the first table would create the second table.

Any advice would be much appreciated and if there is a way of a course as showing as half a day eg. half day PM only, that would be really useful.

Thanks in advance
 

Attachments

  • Schedule.png
    Schedule.png
    68 KB · Views: 15

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Welcome (back) to the MrExcel forum!

First, please update your profile to show what version of Excel you're using. There have been a lot of updates in the last 8 years. Next, are you looking for a macro to create it, or a set of formulas? For example, here is one way with some array formulas:

Book1
ABCDEFGHIJKLM
1EventFromTo1/2 Day?
2Bank Holiday5/6/20245/6/2024
3IT0015/9/20245/10/2024
4H0015/8/20245/9/2024
5EL0015/9/20245/15/2024
6IT0025/15/20245/15/2024Y
7XYZ0015/8/20245/16/2024
8
9Instructor6-May7-May8-May9-May10-May11-May12-May13-May14-May15-May16-May
10Bank Holiday
11IT001IT001
12H001H001
13EL001EL001EL001EL001EL001EL001EL001
14IT002
15XYZ001XYZ001XYZ001XYZ001XYZ001XYZ001XYZ001XYZ001XYZ001
16
Sheet2
Cell Formulas
RangeFormula
B9:L9B9=SEQUENCE(,MAX(D2:D7)-MIN(C2:C7)+1,MIN(C2:C7))
B10:L15B10=LET(tbl,B2:D7,s,SEQUENCE(COUNTA(INDEX(tbl,0,1))),IF((B9#>=INDEX(tbl,s,2))*(B9#<=INDEX(tbl,s,3)),INDEX(tbl,s,1),""))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B10:N21Expression=VLOOKUP(B10,$B$2:$E$7,4,0)="Y"textNO
B10:N21Expression=AND(B10<>"",MOD(ROW(),2)=1)textNO
B10:N21Expression=AND(B10<>"",MOD(ROW(),2)=0)textNO
9:9Expression=A9<>""textNO


The colors will just alternate between peach and green, with blue for half days. If you want more colors, you'd need more Conditional Formatting rules, or a macro.
 
Upvote 0
Hi Eric
thanks for your reply. I have updated my profile as requested.
I am happy to use Macros if that is the better option?
I will apply the formatting you have provided but open to a Macro suggestion and, to add another dimension (which came to me after I had logged off) is if a trainer is assigned to a course, that name cannot be assigned to a course that overlaps those dates they are already assigned to, nor assign a trainer if the schedule shows them as Annual Leave?
Thanks in advance and for your help so far
Terry
 
Upvote 0
Thanks for updating your profile. As far as the macro, is the formatting and formulas a viable solution for you? If so, I don't need to write a macro. If not, you'll need to explain what you want different.

I can create drop-down lists for the trainer column, but I'd need a work area. And how do I know if a trainer is on Annual Leave? Is there a table somewhere with that information? How is it formatted?
 
Upvote 0
Hi Eric, thanks for your reply
So far, I have tabs for
Trainer Details - name, type of courses they can deliver (not all trainers can do all types)
Annual Leave, Absence etc - I select a name from a drop down list derived from Trainers tab
Course details - name, dates
The main tab, Schedule, would have dates along the top and then, course details added to the calendar by either using your formatting formulas or possibly a macro or both?
For the course, the names available are only those who are qualified to deliver it. eg. Bob and Sue can delver Course A but not Ann. So the drop down will only have Bob and Sue (I have done this part already).
So what I would be looking for help with is if Bob is on Holiday when Course A is due to be delivered either his name will not appear or, when selected, an error message to stop me selecting him
This would also be the case if Bob is already booked on a course that is on or overlaps the dates
Another scenario to consider is a course cannot have more than 15 attendees (and I have blocked this happening using Data Validation on the course tab) and if the number of attendees is less than 8, I only need one trainer - between 8 and 15, it needs 2. So is there a way to also prompt for a second name ( I would have Col A and B assigned to Trainer drop down tab) for the 8-15 scenario and then block or stop me adding a second name for less than 8?
Hope that makes sense and I really do appreciate your help and support so far.
Take care
Terry
 
Upvote 0
I've been trying to digest your requirements. It's a lot to take in. My feeling is that you'll need another tab, for the students. This would list all the potential students, and the courses they want to take. There should be some mechanism to keep them from taking 2 classes that are scheduled on the same days. This would also allow some routine somewhere to decide how many people are in a course.

Your course table should probably have a column for how many people can be in the course, and how many instructors are needed (this might just be a formula).

Your Trainer table should probably have a place for courses that each trainer is teaching.

I can also say pretty confidently that this will require at least one macro, probably more. There might be some formulas and Conditional Formatting, but the heavy lifting would have to be done in a macro. It's just too complicated. I should also warn you that this kind of scheduling problem is HARD. It takes more than just knowledge of VBA, you have to come up with an algorithm to figure out where to put everything that doesn't violate any of your requirements. Things like: there are 2 potential trainers for course A, but only one of them can teach course B. So make sure to assign course B first, or if you pick the wrong one for course A, you won't have anyone for course B.

I used to attempt macros like this, but not for a long time. Two possible (but bad) approaches were to exhaustively calculate every combination, throw out the ones that violate some rule, and keep the best; or to randomly assign people to teach, and if it didn't work, try again. Give up if you can't find a working solution in 1000 tries.

I'm going to bow out, since I don't have enough time to devote to this right now. But I have 2 suggestions. First, if you break this up into small enough pieces, you might be able to get people here to do a bit at a time. Part 1 - get from your course tab to the schedule tab with a macro. Also mention if you always will start from scratch, or if you will be updating the course tab, and want to keep the items on the existing schedule. Part 2 - How to update the schedule with the info from your student tab. Have an "Enrolled" column. Maybe changing the formatting colors. Part 3 - from the Trainer tab, the Annual Leave tab, Student, and the Schedule tab, create a way to create drop down lists for Trainers for each of the unassigned courses. This would need to be redone every time something on any of those tabs change. Part 4 - create a macro that will automatically assign all the trainers. That'll be tricky.

Second option, click on the MrExcel Publishing tab on the top and select Excel Consulting Services. These are paid consultants, but they are all vetted carefully and are very good options. You'll likely get a more cohesive solution that way.

Either way, check out the xl2bb add-in tool (see the link in the reply box or my signature). It makes it much easier to display your spreadsheet, and people are more inclined to help than with just a picture.

Sorry this is so long! But I just wanted to give you the best options I know of. Good luck!
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,195
Members
452,616
Latest member
intern444

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