This is the formula that I am currently using:
=SUMPRODUCT((INDIRECT(\"A2\"):INDIRECT(\"A\"&(ROW()-1))=A359)*1)
It works great, but I would
Try this one:
=SUMPRODUCT((($A$2:INDEX($A:$A,ROW()-1))=INDEX($A:$A,ROW()))*1)
it gives you the same result.
But above formula is volatile. Instead I would use next one, say in B3 :
B3
=SUMPRODUCT((($A$2:$A2)=$A3)*1)