Home > database >  Google sheets - Numerate rows between values in arrayformula
Google sheets - Numerate rows between values in arrayformula

Time:05-11

I have an arrayformula that numbers "chapters" based on finding the word "foo" in a range. I need it to also number the "sub-chapters" of those chapters, starting at 1 and resetting for each chapter.

A bit hard to explain but it's like this:

What I have
1 foo


2 foo



3 foo
What I need
1 foo
1
2
2 foo
1
2
3
3 foo

The arrayformula I have found works so far is this:

=ARRAYFORMULA(IF(C:C="foo",COUNTIFS(ROW(C:C),"<="&ROW(C:C),C:C,"foo"),""))

enter image description here

  • Related