I have 2 columns with ID1 AND ID2:
ID1 | ID2 |
---|---|
1 | 1 |
1 | 2 |
2 | 1 |
2 | 2 |
2 | 3 |
3 | 1 |
3 | 2 |
I want to get an auto-increment formula for ID2 - when ID1 changes, the ID2 should start from the beginning.
CodePudding user response:
For a solution using arrayformula, you could try in B2
=Arrayformula(if(A2:A="",,countifs(A2:A, A2:A, row(A2:A), "<="&row(A2:A))))
CodePudding user response:
Try below COUNTIFS()
formula.
=COUNTIFS($A$2:$A2,A2)