Forum Discussion

mwin1680's avatar
mwin1680
Copper Contributor
Jul 14, 2022
Solved

Expanding data in a column or row quickly ex: 1,2,3 --> 1,1,1,2,2,2,3,3,3

As the title suggests I need to expand a list of values but not in its current order again, instead adding the same value after it.  Doesn't feel that complicated but I don't know how to do it for a large amount of data which would save me a lot of time. Sorry if the wording is confusing, don't know how to explain it well. Please see my example below. 

Example expand row A by 3 times. 

Row A
23
53

142

352

43

Into this:

Row A

23

23
23

53

53

53

142

142

142

352

352

352

43

43

43

 

Thanks for your help. 

  • Easier still (same concept): =INDEX(Inputs;INT((SEQUENCE(3*ROWS(Inputs))-1)/3)+1;1)

5 Replies

  • Patrick2788's avatar
    Patrick2788
    Silver Contributor

    mwin1680 

    If you're on 365 and Insider, you might use this:

    =LET(r,ROWS(list)*3,CHOOSEROWS(list,INT(SEQUENCE(r,,1,1/3))))
  • ecovonrein's avatar
    ecovonrein
    Iron Contributor
    Easier still (same concept): =INDEX(Inputs;INT((SEQUENCE(3*ROWS(Inputs))-1)/3)+1;1)
  • ecovonrein's avatar
    ecovonrein
    Iron Contributor
    =MAKEARRAY(3*ROWS(Inputs);1;LAMBDA(I;j;INDEX(Inputs;INT((I-1)/3)+1;1)))

Resources