Hello.

This has stumped me. I just cant get my brains around this one.
 
I have this table (TABLE A):
TABLE A                                         
material_code   consumption     colorway1       colorway2       colorway3       
colorway4       colorwayN
10      0.5     15      25      35      45      0
20      0.2     15      35      0       0       0
30      1       15      0       45      0       0
40      0.8     15      45      0       45      0

And I need to transform into this format (TABLE B):
TABLE B                                                 
material_code   color   total   colorway1       colorway2       colorway3       
colorway4       colorwayN
10      15      0.5     0.5     0       0       0       0
10      25      0.5     0       0.5     0       0       0
10      35      0.5     0       0       0.5     0       0
10      45      0.5     0       0       0       0.5     0
20      15      0.2     0.2     0       0       0       0
20      35      0.2     0       0.2     0       0       0
30      15      1       1       0       0       0       0
30      45      1       0       0       1       0       0
40      15      0.8     0.8     0       0       0       0
40      45      1.6     0       0.8     0       0.8     0

Please note that the number of colorways may be from 1 to N. Its arbitrarily 
sized. 

I've also attached a capture of the excel file on the event that this becomes 
unreadable.

I would really appreciate if anybody would give my problem a go. Otherwise ... 
I'll do a brute-force solution. I have an idea on how to do this but its going 
to be really ugly with a lot of branching and conditions. Oh well, I'm going 
get some sleep (been away for 20 hours). 

Thanks in advance to anybody who give this a go. I appreciate any help.

Thanks again.

r/Alex
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to