How can I transpose some specific columns, while repeating first 4 columns using a formula in Google Sheets?

57 Views Asked by At

I would need the first 4 columns to have their data repeated, while the others are stacked up, like the example below and whose link can be found here: enter image description here

2

There are 2 best solutions below

2
rockinfreakshow On

Here's one approach you may test out:

=reduce(tocol(;1);E2:G6;lambda(a;c;vstack(a;hstack(index(A1:D6;row(c));index(A1:G1;column(c));c))))

enter image description here

UPDATED FORMULA:

=reduce(tocol(;1);E2:index(G:G;match(;0/(A:A<>"")));lambda(a;c;vstack(a;hstack(index(A:D;row(c));index(A1:G1;column(c));c))))
0
z.. On

Here's another solution:

=ARRAYFORMULA(
  LET(F;LAMBDA(x;FILTER(x;A2:A<>""));
      SPLIT(TOCOL(F(A2:A)&"|"&F(B2:B)&"|"&F(C2:C)&"|"&F(D2:D)&"|"&E1:G1&"|"&F(E2:G));"|")))

enter image description here