How to set up groups in google sheets

Viewed 56

Suppose I have the following table of users. How can I set groups of 5 as it appears in the group column? The idea is that each group contains 5 users.

user    group
1   1
2   1
3   1
4   1
5   1
6   2
7   2
8   2
9   2
10  2
11  3
12  3
13  3
14  3
15  3
16  4
17  4
18  4
19  4
20  4
2 Answers

try:

=INDEX(ROUNDDOWN(SEQUENCE(COUNTA(A1:A), 1, 0)/5)+1)

enter image description here

One more option:

=ArrayFormula(IF(LEN(A2:A),ROUNDUP((ROW(A2:A)-1)/5),""))

enter image description here

Related