0 | A | B | C | D | E | F | G | H | I |
---|---|---|---|---|---|---|---|---|---|
1 | Employee | Q1 | Q2 | Q3 | Q4 | Result | |||
2 | E_01 | 500 | 600 | 200 | 800 | E_01 | Q1 | 500 | |
3 | E_02 | 70 | 40 | 10 | 90 | E_01 | Q2 | 600 | |
4 | E_03 | 300 | 700 | 400 | 100 | E_01 | Q3 | 200 | |
5 | E_01 | Q4 | 800 | ||||||
6 | E_02 | Q1 | 70 | ||||||
7 | E_02 | Q2 | 40 | ||||||
8 | E_02 | Q3 | 10 | ||||||
9 | E_02 | Q4 | 90 | ||||||
10 | E_03 | Q1 | 300 | ||||||
11 | E_03 | Q2 | 700 | ||||||
12 | E_03 | Q3 | 400 | ||||||
13 | E_03 | Q4 | 100 |
In Range G2:I13
I want to transform the table from Range A1:E4
from a column-based table to a row-based table.
So far I have been able to develop this formula:
=LET(
a,DROP(TRANSPOSE($A$1:$E$1),1),
b,VSTACK(a,a,a),
c,DROP(VSTACK($A$1:$A$4),1),
d,CHOOSEROWS(c,1),
e,CHOOSEROWS(c,2),
f,CHOOSEROWS(c,3),
g,VSTACK(d,d,d,d),
h,VSTACK(e,e,e,e),
i,VSTACK(f,f,f,f),
j,VSTACK(g,h,i),
k,HSTACK(j,b),
k)
However, I think there is a better and easier solution for it.
I also do not know how to add the values from Range B2:E4
correctly to this formula.
Do you have any idea how to modify the formula to achieve the results in Range G2:I13
?
Here's another solution that uses string concatenation.
=DROP(
REDUCE("",
TOCOL(A2:A4 & "❅" & B1:E1 & "❅" & B2:E4),
LAMBDA(a, c, VSTACK(a, TEXTSPLIT(c, "❅")))
),
1
)