Google Sheets COUNTA Function: Count Non-Empty Cells
In this article
COUNTA counts every cell in a range that contains any kind of data—text, numbers, dates, checkboxes, errors, even a single space—and returns that count. Use it when you want to know how many entries exist, not how many numbers. For example, =COUNTA(A2:A100) tells you how many rows in that column have something in them.
What You'll Need
- A Google account and access to Google Sheets (free with any Google account).
- A spreadsheet with data, or a blank one where you can type a few test values.
- Basic familiarity with typing formulas that start with
=.
Step-by-Step
- Open your spreadsheet. Go to Google Sheets and open the file you want to work in, or create a new blank spreadsheet.
- Click the cell where you want the result. Pick an empty cell outside the range you plan to count, so the formula doesn't accidentally include its own result.
- Type the formula. Start with an equals sign, then
COUNTA, then an opening parenthesis. For example:=COUNTA(A2:A100)
This counts all non-empty cells in A2 through A100. - Select the range with your mouse (optional but easier). After typing
=COUNTA(, drag over the cells you want to count. Sheets inserts the range reference for you. Then type the closing parenthesis). - Press Enter. The cell shows the number of non-empty cells in that range. If you change any cell in the range—adding or deleting content—the count updates automatically.
- Copy the formula down or across if needed. Drag the fill handle (the small square at the bottom-right of the cell) to apply the same pattern to other columns or rows. Relative references adjust automatically; use dollar signs like
$A$2:$A$100if you want the range to stay fixed. - Check the result against a manual count. For a small range, count the filled cells yourself to confirm the formula is doing what you expect. This is especially useful the first time you use COUNTA in a sheet.
Common Mistakes
- Expecting COUNTA to count only numbers. It counts any non-empty cell, including text, dates, booleans, and errors. If you need only numeric values, use
COUNTinstead. - Including header rows. If your range starts at row 1 and row 1 contains headers, COUNTA will count the header as an entry. Start the range at the first data row (e.g., A2) or subtract 1 from the result.
- Forgetting that spaces count. A cell containing only a space is not empty, so COUNTA includes it. This can inflate your count if data was pasted with trailing spaces.
- Using COUNTA on a whole column.
=COUNTA(A:A)counts every non-empty cell in column A, including any stray notes far below your data. It also recalculates slowly on large sheets. Use a bounded range instead. - Mixing up COUNTA and COUNTBLANK. COUNTA counts non-empty cells; COUNTBLANK counts empty ones. They are not opposites unless the range contains only empty and non-empty cells with no formulas returning empty strings.
Tips
- Count with criteria using COUNTIF. If you need to count cells that meet a condition (e.g., contain "Yes"), use
COUNTIF(range, "Yes")instead of COUNTA. - Combine with other functions. COUNTA is often used inside formulas like
=IF(COUNTA(A2:A100)=0, "No data", "Data present")to check whether a range has any entries. - Use named ranges for readability. Select your range, then choose Data > Named ranges to give it a name like "SalesData". Then
=COUNTA(SalesData)is easier to read and maintain. - Remember that formulas returning "" are counted. A formula that returns an empty string is not truly empty, so COUNTA includes it. If you need to exclude such cells, use
COUNTIF(range, "<>")or a more specific condition. - Test on a copy first. When applying COUNTA to a large or important sheet, try it on a duplicate tab to avoid accidental changes.
Troubleshooting
- The result is higher than expected. Check for hidden rows, stray spaces, or cells with formulas that return empty strings. Also confirm your range doesn't include header rows or notes below the data.
- The result is lower than expected. Make sure the range covers all the cells you intended. A common mistake is selecting only part of a column. Widen the range or use a whole-column reference temporarily to see the difference.
- You see an error like #NAME?. This usually means the function name is misspelled or the range reference is invalid. Check that you typed
COUNTAexactly and that the range uses a colon (e.g., A2:A100). - The count doesn't update. Google Sheets recalculates automatically, but if you've pasted values as text or used manual calculation settings, press Ctrl+R (or Cmd+R on Mac) to recalculate, or check File > Settings > Calculation.
- You need to count only visible cells. COUNTA includes hidden rows. To count only visible cells, use
SUBTOTAL(103, range)instead, which ignores filtered-out rows.
Frequently Asked Questions
What is the difference between COUNTA and COUNT?
COUNT counts only numeric values (including dates and times, which Sheets stores as numbers). COUNTA counts all non-empty cells, regardless of type.
Does COUNTA count cells with formulas that return an empty string?
Yes. A cell with a formula like =IF(A1>0, A1, "") that returns "" is not empty, so COUNTA includes it. To exclude such cells, use COUNTIF(range, "<>") or a more specific condition.
Can COUNTA count across multiple ranges?
Yes. You can list multiple ranges separated by commas: =COUNTA(A2:A10, C2:C10). This counts all non-empty cells in both ranges combined.
Does COUNTA work with checkboxes?
Yes. A checked or unchecked checkbox is a value (TRUE or FALSE), so COUNTA counts it as non-empty. To count only checked boxes, use COUNTIF(range, TRUE).
Why does COUNTA give a different result than I see?
Hidden rows, filtered rows, or cells with spaces can affect the count. Also, if your range includes the cell containing the COUNTA formula itself, it will count that cell. Always double-check the range boundaries.
Is COUNTA available in Excel too?
Yes, COUNTA works the same way in Microsoft Excel and most other spreadsheet programs. The syntax and behavior are nearly identical.