Documentation/Calc Functions/COUNT

    From The Document Foundation Wiki

    Function name:

    COUNT

    Category:

    Statistical Analysis

    Summary:

    Counts how many numbers are contained in the supplied list of arguments, ignoring text strings, error values, and empty cells.

    Syntax:

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

    Returns:

    Returns a non-negative integer that is the count of numbers in the supplied list of arguments.

    Arguments:

    Value 1, Value 2, ..., Value 255 give the data set containing the numeric 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 COUNT can accept up to 255 arguments, each argument could specify a range of cells; this means that the count of numbers could be much greater than 255.

    • COUNT counts numbers, dates/times, logical values, and text representations of numbers passed as arguments. If the same numeric value appears multiple times, then it is counted multiple times.
    • COUNT ignores empty cells, any text string passed as an argument that cannot be interpreted as a number, text strings in cells, and error values.
    • The formula =COUNT() returns 0.

    Additional details:

    • COUNT ignores any text in cells or empty cells. If you suspect wrong results, look for text within the supplied data range(s). To highlight text content within a data range, use Calc's View ▸ Value Highlighting feature.
    • Calc provides the following related counting functions:
      • Use COUNTA to count how many values (including 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
    =COUNT(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
    =COUNT(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 but ignores the text in the cell of the fourth argument. Contrast this with the previous example. Note also that the formula =COUNT(A1:A4) returns the same result. 3
    =COUNT("2023-03-13", "TRUE", "-16.2%") Here the function counts all three arguments as numbers. 3
    =COUNT(F5:I5) where cells F5:I5 contain the formulas =3/0, =SQRT(-1), =POWER("str1", "str2"), and =ACOS() respectively. Here the function ignores all cells because each contains an error value (#DIV/0!, Err:502, #VALUE!, and Err:511 respectively). 0
    =COUNT({1; 3; 5; 3; 1}) Here the function counts all five elements of the inline array as numbers, even though the numbers are not unique. 5

    Related LibreOffice functions:

    COUNTA

    COUNTBLANK

    COUNTIF

    COUNTIFS

    ODF standard:

    Section 6.13.6, part 2

    Related (or similar) Excel functions:

    COUNT