jeudi 6 juin 2019

Assigning names without duplicates

I'm struggling with some code to randomise names to a time table.

I have 30 staff that need to be assigned In, Out and Break three times: Morning, Lunch and Afternoon.

I want to assign staff one of each. i.e. Millhouse: In - Morning Out - Afternoon Break - Lunch

So far I have: Sheet 1 - Staff

__|____A_____|______B_____|____________C__________|______D______|
1_|  RANDOM  |    STAFF   |       GET NUMBER      |   VLOOKUP   |
2_|{=RAND()} | Homer      | =LARGE($A:$A,ROW(A1)) | Millhouse   |
3_|{=RAND()} | Bart       | =LARGE($A:$A,ROW(A1)) | Bart        |
4_|{=RAND()} | Millhouse  | =LARGE($A:$A,ROW(A1)) | Homer       |

Column D is =VLOOKUP(C2,$A$2:$B$4,2,0)

How does one put random names into a new sheet without duplication?

Something like this:

__|______A________|______B______
1_|Morning In_____| Millhouse   
2_|Morning Out____| Bart
3_|Morning Break__| Homer
4_|
5_|Lunch In_______| Homer
6_|Lunch Out______| Millhouse
7_|Lunch Break____| Bart
8_|
9_|Afternoon In___| Bart
10|Afternoon Out__| Homer
11|Afternoon Break| Millhouse

Hope this makes sense to someone out there.

Thanx for looking, Sam




Aucun commentaire:

Enregistrer un commentaire