Creating exception to random Team generator

paulgunther

New Member
Joined
Oct 30, 2019
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that assigns players to random holes (Start) based on a chosen number of players per card (I3). It's fairly simple and I also have a macro assigned to a button that copies the "random" column and pastes values to the "static" column to re-randomize at will. The "hole_assignment" table is to assign the holes in a specific, non-sequential order. This works fine as designed.

Question: I would like to occasionally assign certain players to specific holes (column A) and have the Start column account for the pre-assigned starting hole and randomize the rest.

Example: Player 2, pre-assigned hole 8, Player 6 pre-assigned hole 8. I now need the randomizer to only assign 2 additional players to hole 8 and automatically place those players on their respective pre-assigned holes.

Random Card.xlsm
ABCDEFGHI
1
2Non RandomCardPlayerStartGroupRandomStatic
3Player 1270.2263043540.262627438Card Size4
48Player 2820.3879379380.796961803
5Player 31030.6701634850.68759244CardAssigned Hole
6Player 4460.5389380970.35194473911
7Player 51030.6408439280.74684021828
88Player 61030.8737932760.75425269310
9Player 71240.5654047050.627886504412
10Player 8110.4988491780.87951887256
11Player 99100.0932334210.04976329364
12Player 101390.797314870.09855282472
13Player 11110.6819009280.889456719811
14Player 12650.7408938520.569148347913
15Player 13110.340686960.865395664109
16Player 14460.9233135340.369695062113
17Player 151390.7531950940.13534933127
18Player 161180.8870338330.2111415521318
19Player 17460.6603175250.517424354145
20Player 18650.7532726010.554959501
21Player 19650.5153775270.524942895
22Player 201180.2742464570.256438207
23Player 211390.4251237450.149393574
24Player 229100.631862220.026967303
25Player 239100.341396670.096754073
26Player 24460.8051692220.388082165
27Player 251240.4998070020.615633054
28Player 261180.7721284090.217260568
29Player 27270.723632090.292360797
30Player 28110.167612520.905538699
31Player 29270.4967091590.270637506
32Player 30650.1722856520.564299634
33Player 31270.1871673010.261168275
34Player 32820.4636778770.784721414
35Player 33820.3399543980.782527076
36Player 34820.5471294770.796425025
37Player 351180.3305127370.201663754
38Player 361030.7042708740.764741023
39Player 371240.1209793360.597508326
40Player 381240.620319410.639348663
41Player 391390.9444481480.195836014
42Player 409100.7291462530.047685875
WORKING
Cell Formulas
RangeFormula
C3:C42C3=VLOOKUP([@Group],Hole_Assignment,2)
D3:D42D3=CEILING(RANK([@Static],[Static])/$I$3,1)
E3:F42E3=RAND()
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:A42Expression=COUNTIF($A$3:$A$42, A3) = 2textNO
A3:A42Expression=COUNTIF($A$3:$A$42, A3) = 3textNO
A3:A42Expression=COUNTIF($A$3:$A$42, A3) = 4textNO
C3:C42Expression=COUNTIF($C$3:$C$42, C3) = 2textNO
C3:C42Expression=COUNTIF($C$3:$C$42, C3) = 3textNO
C3:C42Expression=COUNTIF($C$3:$C$42, C3) = 4textNO
C3:C42Expression=COUNTIF($C$3:$C$42, C3) = 5textNO
C3:C42Expression=COUNTIF($C$3:$C$42, C3) > 5textNO
B3:B42Cell ValueduplicatestextNO
Cells with Data Validation
CellAllowCriteria
B2Any value
C3:D42Any value
 
No idea if this will work in Sheets, but it will work with Excel online. I've re-done it with some of the newer functions.
Fluff.xlsm
ABCDEFGHIJ
1
2Non RandomCardPlayerStartGroupRandomStatic
3Player 1460.456426630.5058647Card Size4
48Player 2800.981218360.47407113
5Player 39100.550346960.01100784CardAssigned Hole
6Player 4460.571149230.4478608211
7Player 51180.299750180.1499154828
88Player 6800.317102460.23506583310
9Player 71240.310301690.56262691412
10Player 81030.30802710.6888050256
11Player 9820.527549880.7669975864
12Player 10650.555591470.5442785672
1313Player 111300.616901890.3125385811
14Player 121030.328593150.74561371913
15Player 131180.849027810.12112482109
16Player 141390.595501470.09456506113
17Player 15110.110023760.89588577127
18Player 16270.780391230.260977151318
1913Player 171300.365422630.02196248145
20Player 181180.349655530.14466525
21Player 19820.861159910.77906214
22Player 201240.894020760.56387949
23Player 21110.291174980.80168604
24Player 221180.975742630.15135902
25Player 231030.710710640.60526428
26Player 24460.002251960.53305447
27Player 25650.551403980.54464767
28Player 261390.428795720.05742175
29Player 27270.183222320.17572865
30Player 28110.721605220.78870732
31Player 299100.036311040.02545128
32Player 309100.700857940.05301655
33Player 31650.272296270.53647952
34Player 32110.243726050.86435832
35Player 331240.309998040.56042211
36Player 34270.460355180.2867701
37Player 359100.661867140.02889428
38Player 36270.439535290.30523173
39Player 371240.725357750.591905
40Player 381030.178584910.61814166
41Player 39650.987157570.54035428
42Player 40460.587434880.40099069
Home
Cell Formulas
RangeFormula
C3:C42C3=IF([@[Non RandomCard]]<>"",[@[Non RandomCard]],VLOOKUP([@Group],Hole_Assignment,2,0))
D3:D42D3=LET(nrc,[Non RandomCard],y,XLOOKUP(nrc,Hole_Assignment[Assigned Hole],Hole_Assignment[Card],0),tr,ROWS(nrc),c,SEQUENCE(CEILING(tr/$J$3,1)),XLOOKUP([@Static],SORT(FILTER([Static],nrc=""),1,-1),TAKE(TOCOL(IF(SEQUENCE(,$J$3)>BYROW(c,LAMBDA(br,SUM(IF(y=br,1,0)))),c,1/0),2),tr-COUNT(nrc)),0))
E3:E42E3=RAND()
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
No idea if this will work in Sheets, but it will work with Excel online. I've re-done it with some of the newer functions.
Fluff.xlsm
ABCDEFGHIJ
1
2Non RandomCardPlayerStartGroupRandomStatic
3Player 1460.456426630.5058647Card Size4
48Player 2800.981218360.47407113
5Player 39100.550346960.01100784CardAssigned Hole
6Player 4460.571149230.4478608211
7Player 51180.299750180.1499154828
88Player 6800.317102460.23506583310
9Player 71240.310301690.56262691412
10Player 81030.30802710.6888050256
11Player 9820.527549880.7669975864
12Player 10650.555591470.5442785672
1313Player 111300.616901890.3125385811
14Player 121030.328593150.74561371913
15Player 131180.849027810.12112482109
16Player 141390.595501470.09456506113
17Player 15110.110023760.89588577127
18Player 16270.780391230.260977151318
1913Player 171300.365422630.02196248145
20Player 181180.349655530.14466525
21Player 19820.861159910.77906214
22Player 201240.894020760.56387949
23Player 21110.291174980.80168604
24Player 221180.975742630.15135902
25Player 231030.710710640.60526428
26Player 24460.002251960.53305447
27Player 25650.551403980.54464767
28Player 261390.428795720.05742175
29Player 27270.183222320.17572865
30Player 28110.721605220.78870732
31Player 299100.036311040.02545128
32Player 309100.700857940.05301655
33Player 31650.272296270.53647952
34Player 32110.243726050.86435832
35Player 331240.309998040.56042211
36Player 34270.460355180.2867701
37Player 359100.661867140.02889428
38Player 36270.439535290.30523173
39Player 371240.725357750.591905
40Player 381030.178584910.61814166
41Player 39650.987157570.54035428
42Player 40460.587434880.40099069
Home
Cell Formulas
RangeFormula
C3:C42C3=IF([@[Non RandomCard]]<>"",[@[Non RandomCard]],VLOOKUP([@Group],Hole_Assignment,2,0))
D3:D42D3=LET(nrc,[Non RandomCard],y,XLOOKUP(nrc,Hole_Assignment[Assigned Hole],Hole_Assignment[Card],0),tr,ROWS(nrc),c,SEQUENCE(CEILING(tr/$J$3,1)),XLOOKUP([@Static],SORT(FILTER([Static],nrc=""),1,-1),TAKE(TOCOL(IF(SEQUENCE(,$J$3)>BYROW(c,LAMBDA(br,SUM(IF(y=br,1,0)))),c,1/0),2),tr-COUNT(nrc)),0))
E3:E42E3=RAND()
I need some clarification. What is "Hole_Assignment" referencing? I have the range name "Assigned_Hole" referencing cells J5:J19 in your example, but I do not reference "Hole_Assignment" anywhere.
 
Upvote 0
I thought that was a structured Table in I5:J19
 
Upvote 0
Am I understanding this is a recursive LAMBDA formula? (I know just enough to get me in trouble)

Also, what is tr = in the LET function?
 
Upvote 0
No it's not recursive, it just counts how many times the group/card appears in col A (after converting the hole number to the group)
 
Upvote 0

Forum statistics

Threads
1,215,040
Messages
6,122,806
Members
449,095
Latest member
m_smith_solihull

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