Google sheet COUNTA with arrayformula

Viewed 918
3 Answers

Here is a fairly straightforward approach:

=ArrayFormula(IF(B2:B="",,COUNTIFS(B2:B,"<>",ROW(B2:B),"<="&ROW(B2:B))))

It basically reads "If any cell in Column B is blank, leave the return blank; otherwise count the non-blank entries in Column B including only content in rows less than or equal to the current row number."

Try this in cell A1 (delete allcontent below):

=arrayformula({"Sr.No.";iferror(vlookup(
if(B2:B<>"",row(B2:B),),
{filter(if(B2:B<>"",row(B2:B),),if(B2:B<>"",row(B2:B),)<>""),sequence(count(if(B2:B<>"",row(B2:B),)),1)}
,2,0),)})

enter image description here

Try

=arrayformula(if(B2:B="",,mmult(1*(transpose(row(B2:B))<=row(B2:B)),IF(B2:B="",0,1))))
Related