Basically I want the following in excel:
I need that, if I Input following in Sheet 1:
A B C
1 Name Size Color
2 Shirt S,M,L Red, Green
3 Trouser 32,34 White, Black, Grey
The following output automatically generates in Sheet 2:
A B C
1 Name Size Color
2 Shirt-S-Red S Red
3 Shirt-M-Red M Red
4 Shirt-L-Red L Red
5 Shirt-S-Green S Green
6 Shirt-M-Green M Green
7 Shirt-L-Green L Green
8 Trouser-32-White 32 White
9 Trouser-34-White 34 White
10 Trouser-32-Black 32 Black
11 Trouser-34-Black 34 Black
12 Trouser-32-Grey 32 Grey
13 Trouser-34-Grey 34 Grey
Basically, the all the child rows should be generated from the parent rows, like rows 2 to 7 of Sheet 2 have been generated from Row 2 of Sheet 1, and so on.
Further elaborating, Need such a kind of formula that if I add an another row in Sheet 1 with three Sizes and three Colors of Waistcoat, then the formula or the script should automatically insert further 9 rows to Sheet 2 after Row 13 (i.e., with 9 Permutations and Combinations of Input in Row 4 of Sheet 1).
How can I achieve this using Excel formulas or VB Script? Please tell me the solution.
Thanks.
P.S.: I have tried my best to describe this problem of mine. Please comment, if something is ambiguous in understanding the problem, I shall then further elaborate on that point.
This can be down but I needed to use a small helper table to keep the counts of the number of size items in each row, the number of colours in each row, and finally a running total of the possible combinations for each row.
Proof of Concept
Caveats
Yes, there is more than one!
Based on the data in the proof of concept image above, use these formulas in row 3 and copy down.
Column F:
Column G:
The above two formulas count the number of comas. Based on that number they determine the number of items in show for the row, and the number of different colours for the row.
Column H:
This keeps a running total of the number of combinations for each row.
Column J:
This pulls the name from the list in A2:A4 advancing the row as the formula is dragged down based on the running total of combinations. It then concatenates the string with "-" and text from adjacent columns.
Column K:
Where to begin with that bad boy above...Lets just say I broke it out into sever columns first and then back substitute those formulas as required until I got this. It basically pulls out the size letters in sequence and then starts again at the next colour. May have been simpler to make it dependent on the colour name change in the adjacent column. This formula is independent. of the colour name column.
Column L:
Similar to the previous formula this was developed over several columns and then brought back into one cell. It blows apart the colour names, and then grabs each name in sequence after the number of rows equal to the number of sizes has past.