COUNTA
The COUNTA function returns the number of non-empty cells in a dataset.
This can be useful when you need to know how many cells contain data, regardless of the their type (numbers, text, logical values, and so forth).
Syntax
COUNTA(value1, [value2, ...])
| Argument | Description | Permitted values |
|---|---|---|
| value1 | First value or range taken into account in the calculation | Any range of cells |
| [value2, ...] | (optional) Additional values or ranges | Any range of cells |
Examples of use
Counting non-empty cells in a range
If cells A1, A2, A3, A4, and A5 contain values [1, "Text", "", 3, "Data"]:
=COUNTA(A1:A5)
Result: 4, since 4 cells contain data.
Counting non-empty cells with multiple ranges
=COUNTA(A1:A5, B1:B5)
This formula will count all non-empty cells in ranges A1:A5 and B1:B5.
Notes
- The COUNTA function takes into account all types of data, including text, numbers, and Boolean values (for example, TRUE and FALSE).
- Empty cells are not counted.