I need to repeat a value x time in rows. when it is done repeat another value n time. I found SEQUENCE()
but it works only for the first value.
EXAMPLE:
Repeat in rows starting from C1
Repeat A1 value: 42
N time A2 value: 3
then Repeat B1 value: 67
M time B2 value: 5
In C8 I should have the last 67 value
Is there a way to concatenate the =SEQUENCE?
CodePudding user response:
You could use EXPAND()
for example:
=VSTACK(EXPAND(A1,A2,,A1),EXPAND(B1,B2,,B1))
Or go with a somewhat more expandable option:
=XLOOKUP(SEQUENCE(SUM(A2:B2)),SCAN(0,A2:B2,LAMBDA(a,b,a b)),A1:B1,,1)