Q10672 - INFO: COUNTIF

COUNTIF returns the count of cells that meet the condition specified by Condition and Limit.

SYNTAX:

COUNTIF(Condition, Limit, Cell Range):

Condition:  The logical operator to test with:

• For Numeric Comparisons: "<", "<=", "=", "<>", ">", ">="
• For Text Comparisons: "<", "<=", "=", "<>", ">", ">=","CS.=","CS.<>","STARTS","CS.STARTS","ENDS","CS.ENDS","CONTAINS","CS.CONTAINS"

CS stands for Case Sensitive.  See Text examples below.

Limit: Value to compare cell values to.

CellRange: The cell range to anaylze. i.e. (A1:A31)

NOTES:

Also known as Conditional Count.

Cells that contain non-numeric data are evaluated as a zero (0) for comparison to the limit. This includes cells that contain entries with symbols (<4, ND, etc...).

EXAMPLES:

Numeric Comparison Examples:

CountIF(">",1,C4:C34) Count the number of values in the cell range C4:C34 that are greater than (>) the limit 1.

CountIF("<", 6,C4:C34) Count the number of values in the cell range C4:C34 that are less than (<) the limit 6.

Text Comparison Examples:

=COUNTIF("=","RAINY",C3:C33) - Returns the count of values in the cell range that is equal to "RAINY".  Since CS (Case Sensitive) is not specified, will count rainy, Rainy, RAINY, RaInY...

=COUNTIF("STARTS","Sun",C3:C33) - Returns the count of values that start with "Sun" (i.e. the first 3 characters are sun regardless of case).

=COUNTIF("CS.CONTAINS","CLOUD",C3:C33) - Returns the count of values that contain the text CLOUD.  Since CS is specified, text must match the case (i.e. only cells with upper case CLOUD would be counted).