Description
Use this function to count the number of non-blank values in a set of values. Supported in Chains. Can be used with CHILDREFS.
Syntax
COUNTA(range_1,[…,range_254)
Inputs
This function has the following arguments:
| Name | Required | Valid input |
|---|---|---|
range |
Yes | The range for which you want to count the number of cells that are not blank. |
range_254 |
No | Any additional ranges you want included in the count. |
Examples
Sample data
| A | B | |
|---|---|---|
| 1 | Item | Amount |
| 2 | red | |
| 3 | green | 45 |
| 4 | ||
| 5 | red | 92 |
| 6 | blue | 22 |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Count the number of cells in a range that have content. | =COUNTA(A2:B6) |
This formula works in the following manner:
For this data set this formula returns 7. |
| Count the number of cells in multiple ranges that have content. | =COUNTA(A2:A3,B2:B4) |
This formula works in the following manner:
For this data set this formula returns 3. |
| Count the number of non-blank cells in a dynamic range where the number of rows may change. | =COUNTA(B2:INDEX(B:B, MATCH(9.9E+307, B:B))) |
This formula works in the following manner:
For this data set this formula returns 3. |
Notes
- COUNTA supports up to 255 references.
- COUNTA counts cells containing any type of information, including error values, empty text (""), and invisible characters. For example, if the range contains a formula that returns an empty string, the COUNTA function counts that value.
- COUNTA does not count empty cells.
Tips
- If you do not need to count logical values, text, or error values (in other words, if you want to count only cells that contain numbers), use the COUNT function.
- If you want to count only cells that meet certain criteria, use the COUNTIF or COUNTIFS functions.
- To count empty cells, use the COUNTBLANK function.
Related functions
COUNT
COUNTA
COUNTBLANK
COUNTIF
COUNTIFS
ISBLANK
ISERROR
ISNA
ISNUMBER
VALUE