Cycling through a sequence 1-12 at different offsets

Viewed 19

In Sheets I would like fixed sequence of 1-12. I have set it as =sequence(3,4) and I would like it to roll and wrap when I change the first number

Apologies in advance for formatting. I would like the array to roll and wrap when I change the first number in the sequence. So, the starting array is 1-12, but when I change the first number to 4 I would like the sequence to run from there and wrap around back to 1.

1 2 3 4
5 6 7 8
9 10 11 12

But if I start at 4 I would like it to read

4 5 6 7
8 9 10 11
12 1 2 3
1 Answers

Say your start number is in A1:

=ArrayFormula(MOD(SEQUENCE(3,4,A1-1,1),12)+1)

This uses MOD to cycle through the sequence.

Related