Repeat Range of Cells N times with each item in range repeating X times

deLockloire

Board Regular
Joined
Apr 4, 2008
Messages
116
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'd like to have a formula that takes a range of cells, let say (A1:A3):

A
1Value1
2Value2
3Value3

and repeats them in a way that each item in that range gets repeated X times one after the other and the whole result gets repeated N times. For instance, if X=2 and N=3, this is how the result would look like (B1:B18):

B
1Value1
2Value1
3Value2
4Value2
5Value3
6Value3
7Value1
8Value1
9Value2
10Value2
11Value3
12Value3
13Value1
14Value1
15Value2
16Value2
17Value3
18Value3

I kept tinkering with TOCOL, IF and SEQUENCE, but could not make it work in the way I wanted. Any ideas how I could do this?

Regards,
deL
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
How about
Fluff.xlsm
ABC
123
2Value 1Value 1
3Value 2Value 1
4Value 3Value 2
5Value 2
6Value 3
7Value 3
8Value 1
9Value 1
10Value 2
11Value 2
12Value 3
13Value 3
14Value 1
15Value 1
16Value 2
17Value 2
18Value 3
19Value 3
Sheet6
Cell Formulas
RangeFormula
B2:B19B2=TOCOL(IF(SEQUENCE(,C1),TOCOL(IF(SEQUENCE(,B1),A2:A4))),,1)
Dynamic array formulas.
 
Upvote 1
Solution
How about
Fluff.xlsm
ABC
123
2Value 1Value 1
3Value 2Value 1
4Value 3Value 2
5Value 2
6Value 3
7Value 3
8Value 1
9Value 1
10Value 2
11Value 2
12Value 3
13Value 3
14Value 1
15Value 1
16Value 2
17Value 2
18Value 3
19Value 3
Sheet6
Cell Formulas
RangeFormula
B2:B19B2=TOCOL(IF(SEQUENCE(,C1),TOCOL(IF(SEQUENCE(,B1),A2:A4))),,1)
Dynamic array formulas.

Thanks. I tried to do exactly that and now I also see where I got it wrong. Thank you!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
An option with INDEX.
Excel Formula:
=INDEX(A2:A4,MOD(SEQUENCE(ROWS(A2:A4)*B1*C1,,0)/B1,C1)+1)
 
Upvote 0
An option with INDEX.
Excel Formula:
=INDEX(A2:A4,MOD(SEQUENCE(ROWS(A2:A4)*B1*C1,,0)/B1,C1)+1)
Typo.
Excel Formula:
=INDEX(A2:A4,MOD(SEQUENCE(ROWS(A2:A4)*B1*C1,,0)/B1,ROWS(A2:A4))+1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top