2
votes

I need to count the duplicates only until the current row. And I need it to be in an arrayformula as I need it to expand automatically when a new row is added

In excel I would use a table with a function looking something like:

=COUNTIF($A$2:A2,B2) -> in cell C2

In cell C10 the function would automatically become:

=COUNTIF($A$2:A10,B10)

I am not able to perform this action in google sheets:

=ARRAYFORMULA(IF(ROW(J:J)=1,"Column title", IF(ISBLANK(J:J),"",COUNTIF($J$1:J1,J:J))))

I know that $J$1:J1 won't work but am out of ideas.

Is this somehow achievable?

1
It is achievable, can you mock up, and share via link (preferably editable) an example to demonstrate the solution, to be sure I'm understanding the question correctly? - MattKing

1 Answers

2
votes

Something like this?

=ArrayFormula(if(A:A="","",countifs(A:A,A:A,row(A:A),"<="&row(A:A))))

enter image description here