Forum Discussion
leolapa
Jan 08, 2025Brass Contributor
Create array with repeated values from another array
The screenshot below pretty much summarizes what I need to accomplish.
Say I have the "Original array" below.
I need to come up with a formula that will create another array (the "Resulting array" below) by repeating each value from the "Original array" on this case 3 times.
How can I do it?
There are a number of ways. Here is one using 365:
=CHOOSEROWS(Table1,INT(SEQUENCE(ROWS(Table1)*count,,1,1/count)))
4 Replies
- Harun24HRBronze Contributor
Here is another approach using MAKEARRAY().
=MAKEARRAY(ROWS(B4:C6)*E5,COLUMNS(B4:C6),LAMBDA(r,c,INDEX(B4:C6,ROUNDUP(r/E5,0),c)))
In A9:
=LET(array, A2:B4, repeat, B6, INDEX(array, QUOTIENT(SEQUENCE(ROWS(array)*repeat, , 0), repeat)+1, SEQUENCE(, COLUMNS(array))))
A formula cannot copy the colors of the original array.
You might use conditional formatting rules to set the font color to red if the cell contains "red" etc.
- m_tarlerBronze Contributor
There are a number of ways. Here is one using 365:
=CHOOSEROWS(Table1,INT(SEQUENCE(ROWS(Table1)*count,,1,1/count)))
- leolapaBrass Contributor
Thanks!