Roster construction - rearranging OFF days

darxtar

New Member
Joined
Jun 25, 2011
Messages
3
Greetings,

This particular problem has been perplexing me for a few years now. The process I require seems such a likely candidate for automation in some way, but my knowledge gap means that it has always been a tedious manual procedure. I'm using Excel 2007.

Please consider the following cyclic roster segment:

[TABLE="class: grid, width: 800, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Sun[/TD]
[TD]Mon[/TD]
[TD]Tue[/TD]
[TD]Wed[/TD]
[TD]Thu[/TD]
[TD]Fri[/TD]
[TD]Sat[/TD]
[TD]Sun[/TD]
[TD]Mon[/TD]
[TD]Tue[/TD]
[TD]Wed[/TD]
[TD]Thu[/TD]
[TD]Fri[/TD]
[TD]Sat[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]4856[/TD]
[TD]871[/TD]
[TD]871[/TD]
[TD]871[/TD]
[TD]871[/TD]
[TD]2871[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]871[/TD]
[TD]871[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]2871[/TD]
[TD]3856[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]ADO[/TD]
[TD]872[/TD]
[TD]872[/TD]
[TD]2872[/TD]
[TD]3856[/TD]
[TD]4856[/TD]
[TD]872[/TD]
[TD]872[/TD]
[TD]871[/TD]
[TD]871[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]3[/TD]
[TD]4857[/TD]
[TD]872[/TD]
[TD]872[/TD]
[TD]873[/TD]
[TD]873[/TD]
[TD]2873[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]873[/TD]
[TD]873[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]2872[/TD]
[TD]3857[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD]4858[/TD]
[TD]873[/TD]
[TD]873[/TD]
[TD]874[/TD]
[TD]ADO[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]874[/TD]
[TD]874[/TD]
[TD]872[/TD]
[TD]872[/TD]
[TD]2873[/TD]
[TD]OFF[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]5[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]OFF[/TD]
[TD]875[/TD]
[TD]874[/TD]
[TD]2874[/TD]
[TD]3857[/TD]
[TD]4857[/TD]
[TD]875[/TD]
[TD]875[/TD]
[TD]873[/TD]
[TD]873[/TD]
[TD]2874[/TD]
[TD]OFF[/TD]
[/TR]
</tbody>[/TABLE]

Now suppose, for example, I want to move the OFF days on the 1st Monday and Tuesday of line 5 of the roster (Cells C6 and C7) to line 1 of the roster (cells C2 and D2), and ALSO adjust the shifts by moving them downwards accordingly without also moving the OFF days on roster line 3 (in other words, the contents of C5 and D5 move to C6 and D6, C4 and D4 to C5 and D5, and C2 and D2 move to C4 and D4).

Then to balance the number of OFF days in a fortnight (because Roster line 1 now has 6 OFF days while Line 5 has 2), a similar operation is performed to move the 2nd Wednesday and Thursday (cells L2 and M2) on roster line 1 to roster line 5 (cells L6 to M6), again adjusting the shifts accordingly upwards to accommodate where the OFF days will be moved to, but preserving the OFF days on roster line 3 (L4 and M4) to keep them where they are.

Is this at all possible to achieve, either as a VBA routine or otherwise? A solution would be greatly appreciated, and put an end to this tormenting problem.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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