ArrayFormula with countif GoogleSheets

Viewed 106

I am having trouble creating array formula with count if.

What I want to do is display the number of occurrence of a column value.

example :-

  A       B  
----     ----
xyz       2 //Arrayformula goes here
xyz       2
abc       1
pqr       3
pqr       3
pqr       3

I am using this formula but its not working

=ARRAYFROMULA(COUNTA(A2:A,"="&ROW(A2:A)))
2 Answers

Assuming that you have column headings, try this in cell B2:

=arrayformula(if(A2:A<>"",countif(A:A,A2:A),))

use:

=INDEX(IFERROR(1/(1/COUNTIF(A2:A; A2:A))))

enter image description here

Related