Search code examples
google-sheetsgoogle-sheets-formula

How can I number rows automatically, repeating the numbers based on two columns/criteria in Google Sheets?


This formula starts counting based on a column. I'd like to learn however how can I have it repeat the numbers for client A, even though there is more than one row with their name? ={"Task No.";ArrayFormula(IF(LEN(C2:C), SORT(ROW(C2:C),SORT(ROW(C2:C),C2:C,1),1)-MATCH(C2:C,SORT(C2:C),0),))}

CLient Status Task No
A Planned 1
A Cancel 1
B Planned 2
A Done 1
C Planned 3
C Done 3

Solution

  • Here's what you can try:

    =ARRAYFORMULA(LET(u,UNIQUE(A2:A),{"Task No";XLOOKUP(A2:A,u,SEQUENCE(ROWS(u)),)}))