Search code examples
google-sheetsgoogle-sheets-formula

How to restart count based on a criteria, but continue count if the same criteria is found below in Sheet?


So I got the following scenario and my attempt gives a wrong result.

Would appreciate a helping hand here:

enter image description here

Here's a file with the data for test, should you feel like jumping in...


Solution

  • There is a more straightforward approach. Delete everything (including the header) from Col B, then place the following in B1:

    =ArrayFormula({"Task Nº"; IF(A2:A="",,COUNTIFS(A2:A,A2:A,ROW(A2:A),"<="&ROW(A2:A)))})