I am trying to convert the formulas below in an array formula in order to count the occurrences of a value in list of items.
Example:
data | formula | result |
---|---|---|
a | COUNTIF($A$2:$A2,A2) | 1 |
a | COUNTIF($A$2:$A3,A3) | 2 |
b | COUNTIF($A$2:$A4,A4) | 1 |
c | COUNTIF($A$2:$A5,A5) | 1 |
d | COUNTIF($A$2:$A6,A6) | 1 |
d | COUNTIF($A$2:$A7,A7) | 2 |
Any help?
CodePudding user response:
try this out:
=INDEX(IF(A2:A="",,COUNTIFS(A2:A,A2:A,ROW(A2:A),"<="&ROW(A2:A))))
CodePudding user response:
Try with:
=BYROW(A2:A, LAMBDA(each,COUNTIF (A2:each, each)))