3.5.2.7 Countif
Description
This function is used to count the number of values that satisfies a specified condition.
Syntax
double Countif(vector vd, string con$)
Parameters
vd
- is a vector in which you want to count the number.
con$
- is the condition you use to find a sub-range. Double quotation ("") must be added for the condition. Support simpler condition: countif(col(A), "col(A)>10") can be written as countif(col(A), ">10").
Return
Return the count of values that satisfied the condition con$.
Example
newbook; col(A) = data(1,32); countif(col(A),"col(A) > 5 && col(A) < 10")=;//should return 4
//simpler condition countif(col(A), "boston")=; countif(A, 2)=; countif(A, "!=2")=;
//simple expression like Excel //compare with column F COUNTIF(C,"=F") COUNTIF(C,"==F") //compare with string "F" COUNTIF(C,"F") COUNTIF(C,"=="F"") COUNTIF(C,"="F"")
//Support Excel’s Not Equal to Sign in Set Column Values and Cell Formula only COUNTIF(D,"<>146")