How to generate a repeating sequence of numbers in google sheet?

Viewed 1999

So what i need is quite simple, yet somehow i cant get around to find a solution for it.

Basically what i need is for a column, starting from its 2nd row to look list numbers from 1 to 15 and have that sequence repeated all the way to the bottom of the sheet automatically. i was thinking about using arrayformula but couldnt figure out the formula for it.

enter image description here

essentially something like this but it goes all the way down automatically.

2 Answers

Explanation:

You can repeat (REPT) a sequence of numbers from 1 to 15 by using the Sequence formula.

The maximum number of times you want to repeat this sequence will be determined by the total number of rows in your sheet divided by 15.

Solution:

=transpose(split(REPT(concat(JOIN(",",SEQUENCE(1,15)),","),ROUNDDOWN(ROWS(A1:A)/15)),",",true))

Output:

output

non-REPT solution:

=INDEX(ARRAY_CONSTRAIN(FLATTEN(
 SEQUENCE(ROUNDUP(ROWS(A:A)/15), 15)-(
 SEQUENCE(ROUNDUP(ROWS(A:A)/15), 1, 0)*15)), ROWS(A:A)-ROW()+1, 1))

enter image description here

Related