PDA

View Full Version : Procedure needed to group sections of data?



edddie
05-02-2008, 12:06 AM
Hi All! I need some help here. I have a bunch of data that will be group into 3 kinds of
group. Like below :

A B C D
5 5 5 5
6 6 6 6
7 7 7 7
8 8 8 8
5 5 5 5
6 6 6 6
7 7 7 7
8 8 8 8
5 5 5 5
6 6 6 6
7 7 7 7
8 8 8 8

I need a VBA code that could help me sorting like this:
A B C D A B C D A B C D
5 5 5 5 5 5 5 5 5 5 5 5
6 6 6 6 6 6 6 6 6 6 6 6
7 7 7 7 7 7 7 7 7 7 7 7
8 8 8 8 8 8 8 8 8 8 8 8

It will great if in the first program running will ask me how many group of data and its
amount and then sorting like above. Thanks in advance!

Simon Lloyd
05-02-2008, 12:53 AM
Eddie welcome to VBAX, is your data really a single series of letters and then rows of numbers? can you explain what it is you would you are trying to achieve.

edddie
05-02-2008, 01:22 AM
Hi Simon!

This my actual data, it is not a single series of letters and then rows of numbers.


Parts 85 80 75
A01 15998723.24 15998690.53 15998662.3
B01 15998750.41 15998716.38 15998692.7
C01 15998730.07 15998701 15998677.25
D01 15997767.2 15997801.21 15997821.74
A02 15998744.2 15998714.56 15998689.15
B02 15998698.09 15998669.63 15998647.34
C02 15998742.3 15998713.33 15998689.16
D02 16007279.32 15998701 15998677.25
A01 15998729.17 15998696.5 15998668.57
B01 15998757.84 15998724.26 15998701.23
C01 15998737.47 15998709.78 15998687.01
D01 15997773.18 15997809.04 15997828.02
A02 15998751.9 15998723.62 15998699.06
B02 15998710.93 15998680.18 15998657.59
C02 15998750.24 15998721.89 15998698.37
D02 16007271.12 15997826.02 15997844.73
A01 15998741.58 15998709.21 15998681.66
B01 15998773 15998740.62 15998719.14
C01 15998754.09 15998728.91 15998709.16
D01 15997811.34 15997826.02 15997844.73
A02 15998769.88 15998743.1 15998720.62
B02 15998732.6 15998702.69 15998681.07
C02 15998767.35 15998740.2 15998718.41
D02 16007277.79 15998701 15998677.25



Inside coloum Parts there are 3 repeat A01 that mean 3 kinds group of data that begin with first A01 to D02 (group1) and so on.
What I want to achieve, I need a VBA code could ask me first how many sample in each group and how many group inside the data
and after that copy that group to another new group of coloum.

Below the result that I need.
Parts 85 80 75 Parts 85 80 75
A01 15998723.24 15998690.53 15998662.3 A01 15998729.17 15998696.5 15998668.57
B01 15998750.41 15998716.38 15998692.7 B01 15998757.84 15998724.26 15998701.23
C01 15998730.07 15998701 15998677.25 C01 15998737.47 15998709.78 15998687.01
D01 15997767.2 15997801.21 15997821.74 D01 15997773.18 15997809.04 15997828.02
A02 15998744.2 15998714.56 15998689.15 A02 15998751.9 15998723.62 15998699.06
B02 15998698.09 15998669.63 15998647.34 B02 15998710.93 15998680.18 15998657.59
C02 15998742.3 15998713.33 15998689.16 C02 15998750.24 15998721.89 15998698.37
D02 16007279.32 15998701 15998677.25 D02 16007271.12 15997826.02 15997844.73

Parts 85 80 75
A01 15998741.58 15998709.21 15998681.66
B01 15998773 15998740.62 15998719.14
C01 15998754.09 15998728.91 15998709.16
D01 15997811.34 15997826.02 15997844.73
A02 15998769.88 15998743.1 15998720.62
B02 15998732.6 15998702.69 15998681.07
C02 15998767.35 15998740.2 15998718.41
D02 16007277.79 15998701 15998677.25


Thanks alot!

Simon Lloyd
05-02-2008, 01:30 AM
I can't see how you would be able to distinguish between your sets of data, looking at A01 you have given the example of results as:


A01 15998723.24 15998690.53 15998662.3 A01 15998729.17 15998696.5 15998668.57

and


A01 15998741.58 15998709.21 15998681.66
what sets these different results apart in your data lists?, if you manipulated the data by A01 then you would end up with all your data for A01 in a single row or column as there is no seperating factor to give the results you require in your data set.

xld
05-02-2008, 01:34 AM
What do you mean by aking how many groups of data?

What if column A matches, but other columns don't?

Simon Lloyd
05-02-2008, 01:38 AM
Bob, i understand his "grouping" i think its just the quantity of results to return in a row/column for the given part e.g A01 but i dont understand how he expects to make the division between what constitutes e.g Data set A01 (a) and Data set A01(b) as in his example (although they aren't labelled a,b)

xld
05-02-2008, 01:42 AM
Can you just sort by column A then just append when the next row is the same, or will there be situations where that doesn't fit?