ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Divide a list into Groups (https://www.excelbanter.com/excel-discussion-misc-queries/187335-divide-list-into-groups.html)

SerpentineFire

Divide a list into Groups
 
I need divide a list of 500 lines into groups of 8 and assign a number or
name to each group

joel

Divide a list into Groups
 
This requires a simple macro. Do you want a space inbetween each group. How
do you want to assign a number? Write the number in column A? Need a little
more details to get it right.

"SerpentineFire" wrote:

I need divide a list of 500 lines into groups of 8 and assign a number or
name to each group


SerpentineFire

Divide a list into Groups
 
No space needed. I have 500 lines that i need evenly divided in to 8 groups.
So line 1-62 is assigned group 1 (or # 1) 63-124 group 2 and so on... The
group number would be in Column A. Hope this is enough Details

"Joel" wrote:

This requires a simple macro. Do you want a space inbetween each group. How
do you want to assign a number? Write the number in column A? Need a little
more details to get it right.

"SerpentineFire" wrote:

I need divide a list of 500 lines into groups of 8 and assign a number or
name to each group


joel

Divide a list into Groups
 
Sub number_groups()

Const NumLines = 500
Const NumGroups = 8

GroupSize = Int(NumLines / NumGroups)

GroupNum = 1
For Lines = 1 To NumLines
GroupNum = WorksheetFunction.RoundUp(Lines / GroupSize, 0)
Range("A" & Lines) = GroupNum
Next Lines

End Sub

"SerpentineFire" wrote:

No space needed. I have 500 lines that i need evenly divided in to 8 groups.
So line 1-62 is assigned group 1 (or # 1) 63-124 group 2 and so on... The
group number would be in Column A. Hope this is enough Details

"Joel" wrote:

This requires a simple macro. Do you want a space inbetween each group. How
do you want to assign a number? Write the number in column A? Need a little
more details to get it right.

"SerpentineFire" wrote:

I need divide a list of 500 lines into groups of 8 and assign a number or
name to each group



All times are GMT +1. The time now is 03:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com