Reputation: 197
What is the best way to have the table output the letters in certain order and certain number of time.
Table has input X,Y,Z . For each X,Y,Z, it shows how many times they are repeated in the output in that order X,Y,Z.
X Y Z
2 1 1 -> X X Y Z
1 2 0 -> X Y Y
Upvotes: 0
Views: 36
Reputation: 7762
Assuming your table is in A1:C3, enter this array formula** in D2:
=IF(COLUMNS($A:A)>SUM($A2:$C2),"",INDEX($A$1:$C$1,MATCH(TRUE,MMULT($A2:$C2,0+(COLUMN($A2:$C2)>=TRANSPOSE(COLUMN($A2:$C2))))>=COLUMNS($A:A),0)))
Copy to the right until you start to get blanks for the results and also down to give equivalent results for row 3, etc.
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
Upvotes: 0
Reputation: 5962
you can use a formula such as the following to get your output in one cell:
=rept(A$1,A2)&rept(B$1,B2)&rept(C$1,c2)
Upvotes: 1