Using only excel/google sheets formulas, I would like to take a table like this:
a b c
q r s
x y z
and turn it into something like this:
a b c
a b c
a b c
q r s
q r s
q r s
x y z
x y z
x y z
The point is that the rows are duplicated n times but maintain the sort order of the original table.
use in google sheets:
=LAMBDA(y, z, INDEX(SPLIT(FLATTEN(TEXT(BYROW(y, LAMBDA(x,
TEXTJOIN("",,x))), IFERROR(SEQUENCE(1, z)/0, "@"))), "")))
(A1:C3, 3)
or try:
=LAMBDA(x, y, REDUCE(x, SEQUENCE(y-1),
LAMBDA(a, b, IF(b, {a; x}))))
(A1:C3, 3)