CountIf

Counts the number of values in a value set that meet a condition.

Syntax

CountIf(param1, param2, ..., condition)
NbSi(param1, param2, ..., condition)
param1 = first parameter in the set (value, range, or list)
param2 = second parameter in the set (value, range, or list)
... = nth parameter in the set (value, range, or list)
condition = the condition that determines which values to count

Remarks

The condition is understood as a string, starting with a comparison operator (=, <, >, <=, >= or <>), followed by a literal value. If the literal value starts with a ' or ", it will be understood as a string, and string comparisons will be performed. Otherwise, if there is any ambiguity, it will be understood as a numerical value.
If no operator is specified, the "equal to" operator will be used.

This function accepts an unlimited number of parameters.
For an easier way to count only the number of values equal to a specific value, see CountEqual.

Examples

CountIf(1, 2, 3, ">=2.5") = 1
CountIf(1, 2, 3, "<>3") = 2
CountIf("a", "b", "c", "<'banana'") = 2

Classification

Maths Ranges Statistics