G
gromit12
Hi,
I have a table of the format of table 1 below that I need to get into
the format of table 2 below ready for being used as a pivot table. The
actual data set I'm using is MUCH bigger than this, and the thought of
doing this manually makes me shudder. I'm about to roll up my sleeves
to write some code to do it, but I can't help thinking someone must
have written some generic solution to this problem. Anyone ever come
across something like this?
Thanks in advance,
Graham
Table 1: BEFORE
Number Name Age Weight Gender
1 A 10 88 M
2 B 11 193 F
3 C 16 120 M
4 D 14 221 M
5 E 28 142 F
6 F 27 68 F
7 G 42 142 M
8 H 10 176 M
9 I 31 107 F
10 J 26 135 F
11 K 48 212 F
12 L 8 222 M
13 M 0 159 M
Table2:AFTER
Number Name Info InfoValue
1 A Age 10
2 B Age 11
3 C Age 16
4 D Age 14
5 E Age 28
6 F Age 27
7 G Age 42
8 H Age 10
9 I Age 31
10 J Age 26
11 K Age 48
12 L Age 8
13 M Age 0
1 A Weight 88
2 B Weight 193
3 C Weight 120
4 D Weight 221
5 E Weight 142
6 F Weight 68
7 G Weight 142
8 H Weight 176
9 I Weight 107
10 J Weight 135
11 K Weight 212
12 L Weight 222
13 M Weight 159
1 A Gender M
2 B Gender F
3 C Gender M
4 D Gender M
5 E Gender F
6 F Gender F
7 G Gender M
8 H Gender M
9 I Gender F
10 J Gender F
11 K Gender F
12 L Gender M
13 M Gender M
I have a table of the format of table 1 below that I need to get into
the format of table 2 below ready for being used as a pivot table. The
actual data set I'm using is MUCH bigger than this, and the thought of
doing this manually makes me shudder. I'm about to roll up my sleeves
to write some code to do it, but I can't help thinking someone must
have written some generic solution to this problem. Anyone ever come
across something like this?
Thanks in advance,
Graham
Table 1: BEFORE
Number Name Age Weight Gender
1 A 10 88 M
2 B 11 193 F
3 C 16 120 M
4 D 14 221 M
5 E 28 142 F
6 F 27 68 F
7 G 42 142 M
8 H 10 176 M
9 I 31 107 F
10 J 26 135 F
11 K 48 212 F
12 L 8 222 M
13 M 0 159 M
Table2:AFTER
Number Name Info InfoValue
1 A Age 10
2 B Age 11
3 C Age 16
4 D Age 14
5 E Age 28
6 F Age 27
7 G Age 42
8 H Age 10
9 I Age 31
10 J Age 26
11 K Age 48
12 L Age 8
13 M Age 0
1 A Weight 88
2 B Weight 193
3 C Weight 120
4 D Weight 221
5 E Weight 142
6 F Weight 68
7 G Weight 142
8 H Weight 176
9 I Weight 107
10 J Weight 135
11 K Weight 212
12 L Weight 222
13 M Weight 159
1 A Gender M
2 B Gender F
3 C Gender M
4 D Gender M
5 E Gender F
6 F Gender F
7 G Gender M
8 H Gender M
9 I Gender F
10 J Gender F
11 K Gender F
12 L Gender M
13 M Gender M