Cubist
Well-known Member
- Joined
- Oct 5, 2023
- Messages
- 2,139
- Office Version
- 365
- Platform
- Windows
- MacOS
I'm wondering if there's a better way than what I'm doing to generate a cyclical sequence given the length and number of elements in each cycle. For example, I'm generating a sequence of length 21 rows. Each of the cycle consists of 3 elements (1,2,3).
Book1 | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | Length | 21 | |||
2 | Num of element in each cycle | 3 | |||
3 | |||||
4 | |||||
5 | |||||
6 | 1 | ||||
7 | 2 | ||||
8 | 3 | ||||
9 | 1 | ||||
10 | 2 | ||||
11 | 3 | ||||
12 | 1 | ||||
13 | 2 | ||||
14 | 3 | ||||
15 | 1 | ||||
16 | 2 | ||||
17 | 3 | ||||
18 | 1 | ||||
19 | 2 | ||||
20 | 3 | ||||
21 | 1 | ||||
22 | 2 | ||||
23 | 3 | ||||
24 | 1 | ||||
25 | 2 | ||||
26 | 3 | ||||
27 | |||||
Sheet3 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A6:A26 | A6 | =LET(m,MOD(SEQUENCE(B1),B2),IF(m=0,B2,m)) |
Dynamic array formulas. |