CountIf
The Count function returns the number of rows in a table or group for which all given conditions are true.
The CountIf function is an aggregate function.
Aggregate functions evaluate one or more rows of data and return a single value.
In a table element, the aggregate is calculated for each grouping. For information on how to add a grouping with an aggregate calculation to a table, see Group columns in a table.
In a table with no groupings, the aggregate is calculated for each row. For information on how to calculate summary statistics across all rows in a table, see Add summary statistics to a table.
To learn more about using aggregate functions, see Building complex formulas with grouped data.
Syntax
CountIf(condition 1, condition 2+...)
Function arguments:
-
condition 1 (required) The condition to test. If the condition is True, then the row will be counted.
You can use operators in conditions.
-
condition 2+ (optional) Additional conditions to test. If multiple conditions are given, they must all be True in order to be counted.
Example
For example, to count rows where the value in the Age column is greater than 65:
CountIf([Age] > 65)
To count rows where the value in the Age column is greater than 65 and the State column has a value of Ohio:
CountIf([Age] > 65, [State] = ”Ohio”)
To count rows where the value for the Submitted column is a Boolean True, you can use either of the following syntax:
CountIf([Submitted] = True)
CountIf([Submitted])
You can also combine this function with functions that return Boolean output, such as IsNotNull:
CountIf(IsNotNull([Order Number]))Updated 13 days ago
