Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Divide variable numbers into groups | Excel Discussion (Misc queries) | |||
Divide sheet into groups | Excel Programming | |||
Divide a list into Groups | Excel Discussion (Misc queries) | |||
Want to divide a number into groups of thousands | Excel Discussion (Misc queries) | |||
divide a large group of people into smaller groups by their vote | Excel Discussion (Misc queries) |