Hello I am looking for some help because I don't know how to go about this and have been unable to find any resources that guide me on doing what I am trying to do.
So I work for an organization that is trying to bring our shift bid process into the 21st century. I have made some progress by creating a Google Form that submits straight to a Google Sheet. I am trying to make the sheet essentially automate the process and place people according to their seniority in the company.
Here is what I have so far.
The form has three basic questions such as "Seniority Number", "1st-6th bid choice", and "an acknowledgment that their choices are correct." Upon submitting the form a macro runs that will sort the data from highest in seniority to lowest in seniority. The form has conditional formatting set up for the different shifts and I was able to get a checkbox set up to essentially blackout shifts for when we go to check and make sure the automation was correct.
Now… What I am having an issue with…
I have been unsuccessful in figuring out how to get a formula to check each bid choice and see if there is space available.
Example:
All six shifts have 4 slots available.
The first five people have their first choice as A-Days. Unfortunately, that fifth person can't be on that shift because there are already four slots filled. I then need it to check is second choice and if that shift is filled his third and so on all the way up to a sixth choice.
From there I would want it to place all of the people's names into the respective scheduling spot.
Some insight or guidance would be greatly appreciated. I know this is a lot to ask, but I would love to help my organization with this and bring some innovation here.
Here is my sheet so far:
ShiftBidSheet
Best Answer
You are trying to automate the allocation of shifts to workers. There are several factors:
There may be several ways to answer your question, consider this as one solution to your problem.
Sample
The table shows the allocation of the 1st to 6th shift choice, and a final column showing the actual "Assigned Shifts".
1st choice SHIFT =
+D3
1st choice COUNT =
=countif($N$3:N3,N3)
2nd choice SHIFT =
=if(O3<=4," ",E3)
2nd choice COUNT =
=if(P3=" ",0,countif($P$3:P3,P3))
3rd choice SHIFT =
=if(Q3<=4," ",F3)
3rd choice COUNT =
=if(R3=" ",0,countif($R$3:R3,R3))
4th choice SHIFT =
=if(S3<=4," ",G3)
4th choice COUNT =
=if(T3=" ",0,countif($T$3:T3,T3))
5th choice SHIFT =
=if(U3<=4," ",H3)
5th choice COUNT =
=if(V3=" ",0,countif($V$3:V3,V3))
6th choice SHIFT =
=if(W3<=4," ",I3)
6th choice COUNT =
=if(X3=" ",0,countif($X$3:X3,X3))
ASSIGNED SHIFT =
=index(N3:Y3,0,(match(maxifs(N3:Y3,N3:Y3,"<5"),N3:Y3,0))-1)
match
to find the maximum value (maxifs
) across the row where the value is "<5" (the shift is a valid choice). Match returns an index value, and theindex
component of the formula enables selection of the cell to the left of the matched cell - it returns the shift name.Below the shift choices is a small group of subtotals by shift type (row 18 to 23). If count>4, the value is highlighted - though this is a visual indicator only
=countif($N$3:$N$15,N18)
EXAMPLE
Example spreadsheet: