Divide into groups.
I have a list of 25 to 50 people and would like to divide them into 13
groups. How would I do this? |
Divide into groups.
Just to clarify. The names or in A1 €“ A52 and I would like to sort them in A1
€“ 52. If there are only 26 names then they would be in groups of 2 down A1 €“ A52. Thanks! Jeff "Jeff" wrote: I have a list of 25 to 50 people and would like to divide them into 13 groups. How would I do this? |
Divide into groups.
I assume you are looking to randomly assign the people to the groups. Is there any other restictions? Do you want to evenly divide these people among the groups so 25 people would have 12 groups of 2 people and one group of 1. Or some other division. Usually you assign a random number to each person and then sort by the random number. Then perform an algorith to make the groups Sub RandomGroups() Dim Groups(0 To 12, 0 To 3) 'initialize random generator Randomize 'Assume name are on column A LastRow = Range("A" & Rows.Count).End(xlUp).Row 'assign rtandom number For RowCount = 1 To LastRow Range("B" & RowCount) = Rnd Next RowCount 'sort on random number Rows("1:" & LastRow).Sort _ header:=xlNo, _ key1:=Range("B1"), _ order1:=xlAscending For RowCount = 1 To LastRow GroupNum = (RowCount - 1) Mod 13 IndexNum = Int((RowCount - 1) / 13) Groups(GroupNum, IndexNum) = Range("A" & RowCount) Next RowCount End Sub -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170638 Microsoft Office Help |
All times are GMT +1. The time now is 07:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com