how to generate a "serie" of numbers based on a value:

Viewed 29

I am stuck with a little problem.

i would like to auto-generate a Serie of numbers(is this the right description?): for example: The input/value in A1 is 5 the OUTPUT in B1 should now be 1 in in cell B2 - 2, B3 - 3, B4 - 4, B5 - 5, B6 - 1, (STARTING at one again) B7 - 2 . . . and so on until end of range

if I then change the value in A1 to 7 for example it should now "count" from 1 to 7 and repeat until the end of the range again.

any hints available would be much appreciated

1 Answers
=ARRAYFORMULA(MOD(SEQUENCE(ROWS(B2:B),1,0),A1)+1)

this is creating an array of numbers from 0 to however many rows there are on the sheet, then taking the modulus of each number using the value of A1 as a divisor.

MOD() means "what's the remainder after dividing by [n]?" where N in your example case is 6 or 7 or whatever.

Related