Generate list of players for four school teams

imcl75

New Member
Joined
Mar 26, 2024
Messages
10
Office Version
  1. 365
Platform
  1. MacOS
Hi. I want to be able to create 4 football teams from a list of names which is updated weekly. The list starts as a list of all names (these are the names of all children in 3 year groups in my school) and to begin with I will enter an "x" next to their name if they want to play in the games that week. Then, I want to take all the children who have an x next to their name and randomly split them into 4 teams of (as close as possible) equal numbers. It would be useful to be able to have a few specific players from the Year 6 list (which I will identify) put into different teams rather than the same team so the best players get spread out . I've attached the sheet which I am starting with.... any help hugely appreciated as this will save me a lot of effort each week and stop me having to have loads of bits of paper with kids names on which I manually have to put into teams.

1712159007263.png


1712159043925.png
 
I suppose yes, i.e. spreading out the children from the three different year groups across the 4 teams so one team doesn't end up with loads of the Y6 children - who are older and stronger if not actually better players. Is that an easy change?
Not my solution. I started developing a solution which did spread the players out as evenly as possible but it used a mixture of VBA and functions instead of mostly functions. My solution took a tranche
of each year group allocated to each team instead of using a random selection. Snakehips will be able to advise.
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I suppose yes, i.e. spreading out the children from the three different year groups across the 4 teams so one team doesn't end up with loads of the Y6 children - who are older and stronger if not actually better players. Is that an easy change?
I did ask that question in my first response :
After you have placed the 'key' year sixers across the teams is it just a random free for all with the balance of the players?
Or is it better to attempt to spread each year separately over each of the 4 teams?
Your response was:
Totally random is fine after the key year 6 players have been split up
Do you want me to try for a more even distribution of the ages?
 
Upvote 0
I did ask that question in my first response :

Your response was:

Do you want me to try for a more even distribution of the ages?
hi. it's still fine for it to be totally random. don't want to cause any hassle
 
Upvote 0
If I get bored this evening and come up with a solution then I will post it.
Think I have an idea that will not be a great hassle other than it would require you to use a different character in each year group.
Eg. 'k' or 'x' in year six. Maybe 'f' for year four and 'v' for year five?
 
Upvote 0
If I get bored this evening and come up with a solution then I will post it.
Think I have an idea that will not be a great hassle other than it would require you to use a different character in each year group.
Eg. 'k' or 'x' in year six. Maybe 'f' for year four and 'v' for year five?
please don't spend time on this unless you are REALLY bored! I'm very happy to use it as it is. Team are made randomly (by hand) at present and that hasn't caused any issues so very happy to continue with the system of random assignment.
 
Upvote 0
Maybe try this:
Teams sheet remains as was.
Players sheet now requires numeric input for players,
Typically, 4 for year four, 5 for year five, 6 for regular year six and 7 for KEY players.
Conditional formatting rules have changed to suit.
The vba code is now changed.

That should help spread the age groups randomly across the teams.
You could even downgrade a 'known to be useless' year six player by assigning them a 5 or a 4.
Or upgrade a brilliant year four player by giving them a 6.


Picking Teams.xlsm
ABCDEFGHIJKLMNOP
1Year 4Year 5Year 6Player PoolRefRandomRandom Names
2CHy4-14CHy5-1CHy6-1CHy4-144.42803309CHy6-2
3CHy4-2CHy5-25CHy6-27CHy4-444.19604002CHy6-25
4CHy4-3CHy5-3CHy6-36CHy4-544.07818731CHy6-10
5CHy4-44CHy5-4CHy6-47CHy4-644.38168736CHy6-19
6CHy4-54CHy5-55CHy6-56CHy4-1144.59057569CHy6-16
7CHy4-64CHy5-6CHy6-6CHy4-1244.38291265CHy6-4
8CHy4-7CHy5-75CHy6-76CHy4-1344.13364333CHy6-15
9CHy4-8CHy5-8CHy6-86CHy4-1844.01431423CHy6-14
10CHy4-9CHy5-9CHy6-9CHy4-2144.33236783CHy6-17
11CHy4-10CHy5-105CHy6-107CHy4-2444.38884337CHy6-21
12CHy4-114CHy5-115CHy6-11CHy4-2744.11009968CHy6-23
13CHy4-124CHy5-125CHy6-126CHy5-255.84461348CHy6-3
14CHy4-134CHy5-135CHy6-136CHy5-555.57283506CHy6-13
15CHy4-14CHy5-14CHy6-146CHy5-755.42763156CHy6-8
16CHy4-15CHy5-15CHy6-156CHy5-1055.45333743CHy6-7
17CHy4-16CHy5-165CHy6-167CHy5-1155.98964271CHy6-12
18CHy4-17CHy5-17CHy6-176CHy5-1255.34998158CHy6-5
19CHy4-184CHy5-18CHy6-18CHy5-1355.57062803CHy5-11
20CHy4-19CHy5-195CHy6-197CHy5-1655.5447828CHy5-22
21CHy4-20CHy5-20CHy6-20CHy5-1955.25836925CHy5-25
22CHy4-214CHy5-21CHy6-216CHy5-2255.94992313CHy5-2
23CHy4-22CHy5-225CHy6-22CHy5-2555.85708721CHy5-5
24CHy4-23CHy5-23CHy6-236CHy6-366.56462175CHy5-13
25CHy4-244CHy5-24CHy6-24CHy6-566.0836028CHy5-16
26CHy4-25CHy5-255CHy6-257CHy6-766.20484276CHy5-10
27CHy4-26CHy5-26CHy6-26CHy6-866.40980707CHy5-7
28CHy4-274CHy5-27CHy6-27CHy6-1266.18182034CHy5-12
29CHy4-28CHy5-28CHy6-28CHy6-1366.44260325CHy5-19
30CHy4-29CHy5-29CHy6-29CHy6-1466.72306771CHy4-11
31CHy4-30CHy5-30CHy6-30CHy6-1566.7404562CHy4-1
32CHy6-1766.65310689CHy4-24
33CHy6-2166.63544584CHy4-12
34CHy6-2366.56843027CHy4-6
35CHy6-277.91957556CHy4-21
36CHy6-477.2942979CHy4-4
37CHy6-1077.76340805CHy4-13
38CHy6-1677.61409708CHy4-27
39CHy6-1977.6786385CHy4-5
40CHy6-2577.7691039CHy4-18
41
42
Players
Cell Formulas
RangeFormula
L2:M40L2=LET(plyrs,SORT((VSTACK(A2:B101,D2:E101,G2:H101)),2,1),FILTER(plyrs,INDEX(plyrs,,2)<>0))
P2:P40P2=LET(rnd,SORTBY(L2:L101,N2:N101,-1),FILTER(rnd,rnd<>0,))
Dynamic array formulas.
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G2:H101Expression=$H2=7textNO
G2:H101Expression=$H2>3textNO
D2:E101Expression=$E2>3textNO
A2:B101Expression=$B2>3textNO


VBA Code:
Sub RandTeams()
    With Sheets("Players").Range("N2:N101")
       .Formula = "=SORT(IF(L2="""","""",M2+RAND()),,-1)"
        .Value = .Value
    End With
    Sheets("Teams").Select
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

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