# Google Sheets formula - how to count up to 12 and then restart?

I have columns under names of people, the rows correspond to dates below the name. I also have another row with a counter. Something like this:

Bob
Counter 2
12 MAR X
11 MAR
10 MAR X

The counter adds +1 if the field below is not empty. (In this case it is X). What I am trying to do is get this counter get up to 12 and then start counting again from 1 up to another 12. This is what I came up with:

``````= IF(MOD(COUNTA(indirect("B4:B"));12)>0; COUNTA(indirect("B4:B"))- 12*QUOTIENT(COUNTA(Indirect("B4:B"));12);COUNTA(indirect("B4:B")))
``````

It is very clumsy, and besides tied to a specific column, in other words because of the quotes I can move them freely. Does anybody know how to make it easier?

• But now I remember why I did it in that strange way - I think my problems was this - every time I add a new row to add more dates, the formula also changes =MOD(COUNTA(B4:B),12) turns into =MOD(COUNTA(B5:B),12) and It misses the row that I just inserted. Can I avoid this somehow? – Ilya Scv Mar 27 at 15:46

## 1 Answer

It looks like you can just use `=MOD(COUNTA(B4:B),12)`:

(those are 15 X-es, and 15 % 12 = 3)