How to create work shifts based on these conditions?

PhBarreto

New Member
Joined
Aug 9, 2016
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hello guys!
In an Excel spreadsheet, I have two sheets, 'Workers' and 'Shift'.
I need one worker from each sector based on the 'Workers' sheet to be scheduled per week (52 weeks) if there is more than one.
If there is only one consultant, he must be scheduled weekly, if not, I would like the worker to be repeated after everyone has worked their weekly shifts.
Are there any formulas so I can achieve this result?
Thanks in advance!

Sheet 'Workers'
Plantão Semanal - Projeto Klabin.xlsx
ABCD
1SequenceWorkersSectorShift
21Name 1Sector 1Yes
32Name 2Sector 1Yes
43Name 3Sector 1Yes
54Name 4Sector 1No
65Name 5Sector 1No
71Name 6Sector 2Yes
82Name 7Sector 2Yes
93Name 8Sector 2Yes
104Name 9Sector 2No
115Name 10Sector 2Yes
126Name 11Sector 2Yes
131Name 12Sector 3No
141Name 13Sector 4Yes
152Name 14Sector 4Yes
163Name 15Sector 4Yes
171Name 16Sector 5No
181Name 17Sector 6Yes
191Name 18Sector 7Yes
202Name 19Sector 7Yes
213Name 20Sector 7Yes
221Name 21Sector 8No
231Name 22Sector 9Yes
242Name 23Sector 9Yes
253Name 24Sector 9Yes
264Name 25Sector 9No
271Name 26Sector 11Yes
281Name 27Sector 12Yes
291Name 28Sector 13Yes
301Name 29Sector 14No
311Name 30Sector 15Yes
322Name 31Sector 15Yes
333Name 32Sector 15Yes
341Name 33Sector 16Yes
352Name 34Sector 17Yes
361Name 35Sector 18Yes
371Name 36Sector 19No
Weeks



Sheet 'Shift'
Plantão Semanal - Projeto Klabin.xlsx
ABC
1Week's IndexSectorWorker
21Sector 1
31Sector 2
41Sector 3
51Sector 4
61Sector 5
71Sector 6
81Sector 7
91Sector 8
101Sector 9
111Sector 11
121Sector 12
131Sector 13
142Sector 1
152Sector 2
162Sector 3
172Sector 4
182Sector 5
192Sector 6
202Sector 7
212Sector 8
222Sector 9
232Sector 11
242Sector 12
252Sector 13
263Sector 1
273Sector 2
283Sector 3
293Sector 4
303Sector 5
313Sector 6
323Sector 7
333Sector 8
343Sector 9
353Sector 11
363Sector 12
373Sector 13
Testes


Desired result
Plantão Semanal - Projeto Klabin.xlsx
ABC
1Week's IndexSectorWorker
21Sector 1Name 1
31Sector 2Name 6
41Sector 3-
51Sector 4Name 13
61Sector 5-
71Sector 6Name 17
81Sector 7Name 18
91Sector 8-
101Sector 9Name 22
111Sector 11Name 26
121Sector 12Name 27
131Sector 13Name 28
142Sector 1Name 2
152Sector 2Name 7
162Sector 3-
172Sector 4Name 14
182Sector 5-
192Sector 6Name 17
202Sector 7Name 19
212Sector 8-
222Sector 9Name 23
232Sector 11Name 26
242Sector 12Name 27
252Sector 13Name 28
263Sector 1Name 3
273Sector 2Name 8
283Sector 3-
293Sector 4Name 15
303Sector 5-
313Sector 6Name 17
323Sector 7Name 20
333Sector 8-
343Sector 9Name 24
353Sector 11Name 26
363Sector 12Name 27
373Sector 13Name 28
Testes
 
so you dont want to solution i came up with?!?
Unfortunately no, it is a complete solution. The formula you provided only solved part of the problem.

With your formula I have the result below.
Plantão Semanal - Projeto Klabin (1).xlsx
ABC
1Week's IndexSectorWorker
21Sector 1Name 1
32Sector 1Name 2
43Sector 1Name 3
54Sector 1Name 1
65Sector 1Name 1
76Sector 1Name 1
87Sector 1Name 1
98Sector 1Name 1
109Sector 1Name 1
Planilha1


And there needs to be a loop between workers in the sector.
Plantão Semanal - Projeto Klabin (1).xlsx
ABC
13Week's IndexSectorWorker
141Sector 1Name 1
152Sector 1Name 2
163Sector 1Name 3
174Sector 1Name 1
185Sector 1Name 2
196Sector 1Name 3
207Sector 1Name 1
218Sector 1Name 2
229Sector 1Name 3
Planilha1


Did you understand? I don't know if I explained it very well in the first place...
Thanks!
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
i mean i have an updated solution, from your other post that gave more information than your first post.
i understand my first solution only worked for the information given at first, and not the actual end result desired.
try this
column c is the full formula, column d is the same thing, but condensed using let function
-----------------
multiple posts solutions-v3.xlsx
ABCD
1Week's IndexSectorlong Resultlet result
21Sector 1Name 1Name 1
31Sector 2Name 6Name 6
41Sector 3--
51Sector 4Name 13Name 13
61Sector 5--
71Sector 6Name 17Name 17
81Sector 7Name 18Name 18
91Sector 8--
101Sector 9Name 22Name 22
111Sector 11Name 26Name 26
121Sector 12Name 27Name 27
131Sector 13Name 28Name 28
142Sector 1Name 2Name 2
152Sector 2Name 7Name 7
162Sector 3--
172Sector 4Name 14Name 14
182Sector 5--
192Sector 6Name 17Name 17
202Sector 7Name 19Name 19
212Sector 8--
222Sector 9Name 23Name 23
232Sector 11Name 26Name 26
242Sector 12Name 27Name 27
252Sector 13Name 28Name 28
263Sector 1Name 3Name 3
273Sector 2Name 8Name 8
283Sector 3--
293Sector 4Name 15Name 15
303Sector 5--
313Sector 6Name 17Name 17
323Sector 7Name 20Name 20
333Sector 8--
343Sector 9Name 24Name 24
353Sector 11Name 26Name 26
363Sector 12Name 27Name 27
373Sector 13Name 28Name 28
384Sector 1Name 1Name 1
394Sector 2Name 10Name 10
405Sector 1Name 2Name 2
415Sector 2Name 11Name 11
426Sector 1Name 3Name 3
436Sector 2Name 6Name 6
Shift
Cell Formulas
RangeFormula
C2:C43C2=IFERROR(IFERROR(INDEX(FILTER(Workers!$B$2:$B$37,(Workers!$C$2:$C$37=B2)*(Workers!$D$2:$D$37="Yes")),IF(A2>COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"),IF(MOD(A2,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"))=0,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"),MOD(A2,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"))),A2)),INDEX(FILTER(Workers!$B$2:$B$37,(Workers!$C$2:$C$37=B2)*(Workers!$D$2:$D$37="Yes")),1)),"-")
D2:D43D2=LET(fff,FILTER(Workers!$B$2:$B$37,(Workers!$C$2:$C$37=Shift!B2)*(Workers!$D$2:$D$37="Yes")),ccc,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"),mmm,MOD(A2,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes")),IFERROR(IFERROR(INDEX(fff,IF(A2>ccc,IF(mmm=0,ccc,mmm),A2)),INDEX(fff,1)),"-"))
 
Upvote 1
Solution
i mean i have an updated solution, from your other post that gave more information than your first post.
i understand my first solution only worked for the information given at first, and not the actual end result desired.
try this
column c is the full formula, column d is the same thing, but condensed using let function
-----------------
multiple posts solutions-v3.xlsx
ABCD
1Week's IndexSectorlong Resultlet result
21Sector 1Name 1Name 1
31Sector 2Name 6Name 6
41Sector 3--
51Sector 4Name 13Name 13
61Sector 5--
71Sector 6Name 17Name 17
81Sector 7Name 18Name 18
91Sector 8--
101Sector 9Name 22Name 22
111Sector 11Name 26Name 26
121Sector 12Name 27Name 27
131Sector 13Name 28Name 28
142Sector 1Name 2Name 2
152Sector 2Name 7Name 7
162Sector 3--
172Sector 4Name 14Name 14
182Sector 5--
192Sector 6Name 17Name 17
202Sector 7Name 19Name 19
212Sector 8--
222Sector 9Name 23Name 23
232Sector 11Name 26Name 26
242Sector 12Name 27Name 27
252Sector 13Name 28Name 28
263Sector 1Name 3Name 3
273Sector 2Name 8Name 8
283Sector 3--
293Sector 4Name 15Name 15
303Sector 5--
313Sector 6Name 17Name 17
323Sector 7Name 20Name 20
333Sector 8--
343Sector 9Name 24Name 24
353Sector 11Name 26Name 26
363Sector 12Name 27Name 27
373Sector 13Name 28Name 28
384Sector 1Name 1Name 1
394Sector 2Name 10Name 10
405Sector 1Name 2Name 2
415Sector 2Name 11Name 11
426Sector 1Name 3Name 3
436Sector 2Name 6Name 6
Shift
Cell Formulas
RangeFormula
C2:C43C2=IFERROR(IFERROR(INDEX(FILTER(Workers!$B$2:$B$37,(Workers!$C$2:$C$37=B2)*(Workers!$D$2:$D$37="Yes")),IF(A2>COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"),IF(MOD(A2,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"))=0,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"),MOD(A2,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"))),A2)),INDEX(FILTER(Workers!$B$2:$B$37,(Workers!$C$2:$C$37=B2)*(Workers!$D$2:$D$37="Yes")),1)),"-")
D2:D43D2=LET(fff,FILTER(Workers!$B$2:$B$37,(Workers!$C$2:$C$37=Shift!B2)*(Workers!$D$2:$D$37="Yes")),ccc,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes"),mmm,MOD(A2,COUNTIFS(Workers!$C$2:$C$37,B2,Workers!$D$2:$D$37,"Yes")),IFERROR(IFERROR(INDEX(fff,IF(A2>ccc,IF(mmm=0,ccc,mmm),A2)),INDEX(fff,1)),"-"))

@ExceLoki This is awesome! This is exactly what I was looking for! Thank you very much for your help and time!
I have a big smile on my face and I really appreciate your help!
Thank you again!
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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