Need help with scheduling formulas

jordan89m

New Member
Joined
Aug 3, 2022
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
I work at a hotel and we have scheduled crews staying with us. In an effort to better assign crew members to rooms with as little unoccupied time between stays AND also maintaining at least a given amount of time between stays for cleaning I've been trying to work out a rooming schedule.

I'll try to break it down:

in a tab titled 'days' is a table with all records of the dataset.
Book.xlsx
ABCDEFG
1arrdatearrtimedepdatedeptimerecord#Column6Column7
201/08/227:2803/08/2216:251036150FEXXHX16:25
301/08/2221:1002/08/2222:00966950TEDDHX22:00
401/08/2221:1002/08/2222:00967050TEDDHX22:00
501/08/2221:3102/08/2222:05966750TEDDHX22:05
601/08/2221:3102/08/2222:05966850TEDDHX22:05
702/08/226:1004/08/225:411369850MEXXHX05:41
802/08/226:1004/08/225:411369950MEXXHX05:41
902/08/227:2804/08/2216:251036250FEXXHX16:25
1002/08/227:2804/08/2216:251036350FEXXHX16:25
1102/08/2211:3903/08/225:35967550TEDDHX05:35
1202/08/2211:3903/08/225:35967650TEDDHX05:35
1302/08/2212:4503/08/227:15967750TEDDHX07:15
1402/08/2212:4503/08/227:15967850TEDDHX07:15
days
Cell Formulas
RangeFormula
G2:G14G2=days!$D2


in the tab titled buffer there is one cell indicating a cutoff time in which a room is no longer cleanable on a given day, and below it, all known departure times in column A and the ideal end of cleaning times in column B.

Cell Formulas
RangeFormula
A8:A28A8=IFERROR(UNIQUE(days!$D$2:$D$1400),"")
B8:B28B8=$A8+1.5/24
Press CTRL+SHIFT+ENTER to enter array formulas.


then in the tab titled main, room numbers are populated down column A

Book.xlsx
ABCD
130-Jul
2701
3702
4716
5717
6718
7719
8720
9721
10801
11802
12816
13817
main


Right of the rooms is where data for each day is populated. As you can see, 4 crew members departing after the cutoff time on 2-aug trigger a "-20" flag (this is internal jargon, but basically means the room is not usable until the next day.) Record numbers from the 'days' tab skip rows every time a -20 is present. This is a must.

Cell Formulas
RangeFormula
H2:H13,K2:K13H2=IF(J2="-20","",IFERROR(INDEX(days!$A$2:$E$1400,SMALL(IF(ISNUMBER(MATCH(days!$A$2:$A$1400,H$1,0)),MATCH(ROW(days!$A$2:$A$1400),ROW(days!$A$2:$A$1400)),""),ROWS(H$1:H1)-COUNTIF(J$2:J2,"-20")),5),""))
I2:I13,L2:L13I2=IFERROR(VLOOKUP(H2,days!$E$2:$G$1400,3,FALSE),"")
J2:J13,M2:M13J2=IFERROR(IF(VLOOKUP(E2,days!$E$2:$G$1400,3,FALSE)>buffer!$A$5,"-20",""),"")
Press CTRL+SHIFT+ENTER to enter array formulas.


Now for the part I'm stuck on...
I need to maintain the skipping rows where -20 is present but also now only assign records from the days tab if their arrival time is equal to or greater than the buffer time from the previous crew occupying the room. If it is not, the next room would be tested by a formula, basically distributing all expected crew on a given date to various rooms.

Looking forward to seeing what you geniuses put together! This forum has taught me much over the years, though I've only just registered in light of my new dilemma.

I'm sure more clarification will be needed and I'll be checking back constantly to do so!

Cheers,
Jordan
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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