I consider as a simple MWE an Excel table that contains 7 (columns) and 3 rows. I try to repeat each element x times, so that the last column in this row runs to the last column in the entire table. The number of repetitions in each row is therefore determined by the last column in that row.
For example, in row 1 the last element is in column 3, so each element must be repeated 5 times (7 columns in total - 3 last position + 1).
In row 2 the last element is in column 5, so each element must be repeated 3 times (7 columns in total - 5 last position + 1).
I have a table with many columns and rows, but the general structure remains the same, where the first element has 3 values and 2 values are added at each row, with the individual values being different in all cells.
Any thoughts on how to achieve this in an automated way?
My initial spreadsheet looks like this:
The result should look like this:
For example, in row 1 the last element is in column 3, so each element must be repeated 5 times (7 columns in total - 3 last position + 1).
In row 2 the last element is in column 5, so each element must be repeated 3 times (7 columns in total - 5 last position + 1).
I have a table with many columns and rows, but the general structure remains the same, where the first element has 3 values and 2 values are added at each row, with the individual values being different in all cells.
Any thoughts on how to achieve this in an automated way?
My initial spreadsheet looks like this:
1 | 2 | 3 | 4 | 5 | 6 | 7 | |
1 | 0.233 | 0.777 | 0.853 | ||||
2 | 0.814 | 0.947 | 0.387 | 0.119 | 0.691 | ||
3 | 0.574 | 0.231 | 0.050 | 0.453 | 0.952 | 0.786 | 0.856 |
The result should look like this:
1 | 2 | 3 | 4 | 5 | 6 | 7 | |
1 | 0.233 | 0.233 | 0.233 | 0.233 | 0.233 | ||
1 | 0.777 | 0.777 | 0.777 | 0.777 | 0.777 | ||
1 | 0.853 | 0.853 | 0.853 | 0.853 | 0.853 | ||
2 | 0.814 | 0.814 | 0.814 | ||||
2 | 0.947 | 0.947 | 0.947 | ||||
2 | 0.387 | 0.387 | 0.387 | ||||
2 | 0.119 | 0.119 | 0.119 | ||||
2 | 0.691 | 0.691 | 0.691 | ||||
3 | 0.574 | 0.231 | 0.050 | 0.453 | 0.952 | 0.786 | 0.856 |