Use COUNTA to count cells that aren't blank

Applies To
Excel for Microsoft 365 Excel 2024 Excel 2021

Suppose you need to know if your team members entered all their project hours in a worksheet. In other words, you need to count the cells that have data. To complicate matters, the data might not be numeric. Some of your team members might enter placeholder values such as "TBD". For that, use the COUNTA function.

Count cells that have data

This example counts only the cells that have data.

Screenshot that shows the COUNTA function.

Be aware that "data" can include spaces, which you can't see. And yes, you could probably count the blanks in this example yourself, but imagine doing that in a big workbook. So, to use the formula:

  1. Determine the range of cells you want to count. The example earlier used cells B2 through D6.
  2. Select the cell where you want to see the result, the actual count. Let's call that the result cell.
  3. In either the result cell or the formula bar, type the formula and press Enter, like so:
    =COUNTA(B2:B6)

Count cells that have data in more than one range

This example counts cells in B2 through D6, and in B9 through D13.

Screenshot that shows using the COUNTA function to count 2 cell ranges.

You can see Excel highlights the cell ranges, and when you press Enter, the result appears:

Screenshot that shows COUNTA function results.

If you know you don't need to count text data, just numbers and dates, use the COUNT function.

More ways to count cells that have data