Code Review Videos > How I Fixed > How To: Count All Rows in a Range in Google Sheets

How To: Count All Rows in a Range in Google Sheets

A simple one on the surface of it, but I couldn’t find a quick answer. Hopefully this saves you some time

Let’s say you have a Google Sheet where you have a bunch of rows, and you want to count the total number of rows in a range dynamically. In other words, when you add another row of text, the count should update.

How can you do this?

How To: Count All Rows in a Range in Google Sheets

The magic formula is to use COUNTA, not COUNT.

COUNT works fine if your data is numeric.

However, if your data is not numeric, like the rowX line in column B above, you need to use COUNTA.

Here I have used =counta(B1:B44), which gives 16.

That’s fine, but what if you want every entry in column B?

Well, one way is just to whack in a suitably large number. Like =counta(B1:B44444). But a better way is just to use B itself.

So you could count literally every row with =counta(B:B).

Or it may be that the first row is your headers, so a better version might be =counta(B2:B).

Anyway, it worked for me. And hopefully it saves you some hair loss if you’re trying to figure that out also.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.