I am having difficulties trying to get an array formula to increment a column and restart the increment whenever a condition has been met.
Here is an example of what I am trying to achieve, but this has been done manually. It would be great if this could work in an array formula as we'll be adding more rows and would rather not drag the formula down.
[Update based on feedback of the original post]
- Column A contains a list of names and teams.
- Names are already organised into teams.
- The aim is to go through each row and provide a name with an index starting from 1.
- Then when a new team is found in column A the index starts again from 0.
- The aim is to make this an Array Formula to avoid having to manually re-add the formula when more rows are added.
Link to sheet: https://docs.google.com/spreadsheets/d/1K00LRFNrN99fFXQO1tzp8jjZeCuTxwENXNGuLj0K0ao/edit?usp=sharing
Any thoughts or advice on this would be greatly appreciated.


=ARRAYFORMULA(IF($A2:$A = "TEAM", 0, ADD(OFFSET($B2:$B,-1,0),1)))But this doesn't update the full range correctly unless I keep deleting the generated content - herbertsworld