Generating names for groups

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Group allocator.xlsx
ABCDEFGHIJKLMN
1How many people?21
2NameRandRank GroupingTeamTeam size7Team no.Count
3Vic0.84372440.571429118
4Bob0.55133691.285714226
5Kev0.78557460.857143137
6Mary0.529755101.428571240
7Fred0.97447410.142857150
8Steve0.522386111.571429260
9Jack0.67176381.142857270
10Jake0.040347192.714286380
11Mick0.92692320.2857141
12Tom0.203266162.2857143Team 1Team 2Team 3Team 4Team 5Team 6Team 7
13Jess0.232937152.1428573
14Jo0.057397182.5714293
15Joe0.90526930.4285711
16Sue0.751883711
17Sharon0.81832250.7142861
18Noel0.183788172.4285713
19Jack S0.521619121.7142862
20Alan0.329118152.1428573
21Mike0.356218131.8571432
22****0.86409840.5714291
23ken0.21202172.4285713
Sheet1
Cell Formulas
RangeFormula
H1H1=ROWS(Table1[Team])
C21,C3:C19C3=RANK(B3,$B$3:$B$21)
D3:D23D3=C3/$H$2
E3:E23E3=CEILING(D3,1)
C20,C23C20=RANK(B20,$B$3:$B$23)
C22C22=RANK(B22,$B$3:$B$22)
K3:K10K3=COUNTIF(Table1[Team],J3)


The idea here is to produce lists of names that belong to each allocated group once the main spreadsheet has randomly allocated the names to the groups.
Desired output under Team 1 would have Vic, Kev, Fred, Mick etc. so anyone who records a 1 under Team. Under Team 2 would be Bob, Mary, Steve etc.

This output would be listed under Team 1, Team 2 etc. which are H12, I12 etc.

Column B has a formula for randomising the data, RAND(), I've converted this column to values for the sake of this example but I do have another problem with this spreadsheet. The groups don't always come out evenly and in this instance with 21 people I get groups of 8,7 and 6 instead of 3 groups of 7 which is what I need. I find that I need to recalculate a few times before the groups are even, perhaps my formulae could be improved upon. Looking for a formula/function solution to both the output and if possible the even group creation.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,

What about this?
Cell Formulas
RangeFormula
F1F1=ROWS(Table13[Name])
B3:B23B3=RAND()
C3:C23C3=RANK(B3,$B$3:$B$23)
H3:N14H3=IFERROR(IF(ROW(H1)>$F$2,"",INDEX(Table13[[Name]:[Name]],MATCH(($F$2*COLUMNS($H$2:H$2))-ROWS(H$2:H2)+1,Table13[[Rank ]:[Rank ]],0))),"")


For reference (and because I need to practice), with XLOOKUP:
=IFERROR(IF(ROW(H1)>$F$2,"",XLOOKUP(($F$2*COLUMNS($H$2:H$2))-ROWS(H$2:H2)+1,Table13[[Rank ]:[Rank ]],Table13[[Name]:[Name]],,0,1)),"")
 
Upvote 0
Hi Gra,

Thanks I'm working through it. Should there be anything in H1? Also when I download your spreadsheet the formulae under Team 1, Team 2 etc have the formulae as text rather than values.
 
Upvote 0
Hi Tigerexcel,

Sometimes I've the same issue when I paste xl2bb in my workbooks. I'm on EU settings. Probably ";" needs to be replaced by ",". Though it seems they have been replaced by the add-on just fine.
Press F2 and confirm the formula again. I suspect that will work.

H1 is only used as a reference for row. Does not matter whether it is empty or not.
 
Upvote 0
Hi again Gra,

I've tried replacing and re-typing some of the formulae to no avail. I suspect it's the table references that are throwing the formulae out. What I can see is that your formulae are very clever and streamline quite a few steps. I'll have to try and remove the table formatting so that it's just a normal range to try and understand this better.
 
Upvote 0
I've removed the Table syntax in the formulae and now it all works. It's so clever, I particularly like how you don't have to keep randomising until you get even numbers in the groups.
I don't quite understand what the formula is doing in the MATCH component, could you explain that please?
 
Upvote 0
Good question.
Match returns a position from the rank range, index then returns the name of that position.

You were indeed making it more complicaties then needed ?. I guess we all go through such a state.

Maybe the table reference to the rank column was a problem. There was a trailing space in the sample. It is not there in your workbook?

Thanks for again positive feedback. I like clever, should do that more often ?
 
Upvote 0
Thanks Gra, but how does your formula know how to set the values in a 3 x 7 matrix or 5 x 4, in other words how is the positioning decided upon via your formula?
 
Upvote 0
Thanks Gra, but how does your formula know how to set the values in a 3 x 7 matrix or 5 x 4, in other words how is the positioning decided upon via your formula?
Never mind, I can see how the IF function does that now.
 
Upvote 0
I was actually typing a reply:
Let's break down the formula: $F$2*COLUMNS($H$2:H$2))-ROWS(H$2:H2)+1

It's size * columns, so you get 7, 14 , 21, 28, etc. Then subtract rows 0, 1, 2, 3 until the row number exceeds the team size, indeed like you said the IF-part.
 
Upvote 0

Forum statistics

Threads
1,214,869
Messages
6,122,015
Members
449,060
Latest member
LinusJE

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