COUNTA function
COUNTA counts every non-empty entry of any type, including text, errors and empty strings. It is good for counting filled rows in a list, even where a formula returns an empty string.
Example
Read it as a sentence: count the cells in A1:A8 that are not empty, which gives 8.
Excel shows 8
A
1
2
2
4
3
4
4
4
5
5
6
5
7
7
8
9
Data
Syntax
COUNTA(value1, [value2], ...)
Arguments in [square brackets] are optional.
-
value1(required) - First value, array or range.
-
value2(optional) - Further values or ranges.
Returns: How many of the arguments are not empty.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=COUNTA({2,4,4,4,5,5,7,9}) | 8 | Array constant |
=COUNTA(10,"20",TRUE) | 3 | Direct args: number, text-number, TRUE |
=COUNTA(10,"abc") | 2 | Direct arg: non-numeric text |
=COUNTA(5) | 1 | Single number |
=COUNTA({1,"2",TRUE,3}) | 4 | Array with text and boolean |
=COUNTA(Data!A1:A8) | 8 | Range of numbers |
=COUNTA(Data!B1:B8) | 7 | Mixed range: num, text-number, TRUE, blank, text, FALSE |
=COUNTA(Data!C1:C5) | 5 | Range containing #N/A |
The Data sheet these formulas read
A cell that starts with = holds that formula.
A
B
C
1
2
10
1
2
4
20
2
3
4
TRUE
=NA()
4
4
4
5
5
abc
5
6
5
30
7
7
FALSE
8
9
40
Data
Watch out for
- A formula returning "" still counts as non-empty.
- Errors are counted too.
Where it works
- Excel
- COUNTA is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Statistical functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .