How to count cells that are not blank in Excel
Formula (Excel and Google Sheets)
=COUNTA(C2:C8)Use =COUNTA(range). It counts every cell that has anything in it: numbers, text, dates and errors.
- Result on the example
- 5 in
G1 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in G1. Change any input and the result updates, or edit the formula to experiment.
How it works
COUNTA counts cells that are not empty, whatever they contain. COUNT would also work here because dates are numbers, but COUNTA is the general answer: it counts text too.
=COUNTA(C2:C8)Result5
C2:C87 rows × 1 col: 9/22/2026, (empty), 9/21/2026, 9/23/2026, …A range: 7 cells in one column.
COUNTA(C2:C8)5COUNTA: Counts cells that are not empty.- value1
C2:C87 rows × 1 col: 9/22/2026, (empty), 9/21/2026, 9/23/2026, …
- value1
In Google Sheets
The same formula works in Google Sheets: =COUNTA(C2:C8). We ran it in Google Sheets mode on the same data and it returns 5.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =ROWS(C2:C8)-COUNTBLANK(C2:C8) | 5 | Rows minus blanks gives the same count. COUNTBLANK also counts formulas that return "". |
| =COUNTIF(C2:C8,"<>") | 5 | COUNTIF with "not equal to nothing" is handy when you need it inside COUNTIFS with other conditions. |
Common mistakes
- A cell with a formula that returns "" looks empty but COUNTA counts it. Use
=SUMPRODUCT(--(C2:C8<>""))to skip those too. - A cell with a single space is not blank. TRIM the data or count with
=SUMPRODUCT(--(TRIM(C2:C8)<>"")).
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Count cells that are not blank
G1, count how many students have a submission date for assignment 2 (C2:C8).Questions
What is the difference between COUNT and COUNTA?
COUNT counts only numbers (and dates, which are numbers). COUNTA counts every non-empty cell, including text and errors.
How do I count blank cells instead?
Use =COUNTBLANK(C2:C8).
Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.