Jump to content

Documentation/Calc Functions/COUNTA

From The Document Foundation Wiki

Function name:

COUNTA

Category:

Statistical Analysis

Summary:

Counts all numbers, dates/times, logical values, text strings (including empty strings with zero length), and error values contained in the supplied list of arguments. COUNTA ignores empty cells.

Syntax:

COUNTA(Value 1 [; Value 2 [; … [; Value 255]]])

Returns:

Returns a non-negative integer that is the count of numbers, dates/times, logical values, text strings, and error values in the supplied list of arguments.

Arguments:

Value 1, Value 2, ..., Value 255 give the data set containing the numbers, dates/times, logical values, text strings, and error values to be counted. Each argument may be a value or an expression, a reference to a single cell, a reference to a cell range, the name of a named or database range, or an inline array. Note that although COUNTA can accept up to 255 arguments, each argument could specify a range of cells; this means that the count could be much greater than 255.

  • COUNTA counts numbers, dates/times, logical values, text strings, and error values. If the same item appears multiple times, then it is counted multiple times.
  • COUNTA ignores empty cells.
  • The formula =COUNTA() returns 0.

Additional details:

  • Calc provides the following related counting functions:
    • Use COUNT to count how many numbers (ignoring text strings and error values) are contained in a list of arguments.
    • Use COUNTBLANK to count how many empty cells are contained in a cell range.
    • Use COUNTIF to count the number of cells in a cell range that meet a specified criterion.
    • Use COUNTIFS to count the number of cells that meet specified criteria in multiple ranges.

Examples:

Formula Description Returns
=COUNTA(2; 4; 6; "8") Here the function counts the numbers in the first three arguments and the text representation of a number in the fourth argument. 4
=COUNTA(A1; A2; A3; A4) where cells A1:A3 contain the numbers 2, 4, and 6 respectively, while cell A4 contains the formula ="8". Here the function counts the numbers in the cells of the first three arguments and the text representation of a number in the cell of the fourth argument. Contrast this with the corresponding example for the COUNT function. Note also that the formula =COUNTA(A1:A4) returns the same result. 4
=COUNTA("2023-03-13", "TRUE", "-16.2%") Here the function counts all three arguments. 3
=COUNTA(F5:I5) where cells F5:I5 contain the formulas =3/0, =SQRT(-1), =POWER("str1", "str2"), and =ACOS() respectively. Here the function counts all cells because each contains an error value (#DIV/0!, Err:502, #VALUE!, and Err:511 respectively). 4
=COUNTA({1; 3; 5; 3; 1}) Here the function counts all five elements of the inline array, even though the numbers are not unique. 5
=COUNTA(""; C1) where cell C1 contains the formula ="". Here the function counts the empty string of the first argument and the empty string in the cell referenced in the second argument. 2

Related LibreOffice functions:

COUNT

COUNTBLANK

COUNTIF

COUNTIFS

ODF standard:

Section 6.13.7, part 2

Related (or similar) Excel functions:

COUNTA