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:
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))))
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))))