Skip to main content

COUNTIF

Counts the number of cells that meet a specified condition.

Syntax

COUNTIF(range, criteria)

Arguments

  • range: The range of cells to count.
  • criteria: The condition that defines which cells to count.

Criteria

Simple Expressions
  • >,<,>=,<=,==,!=,===,!==: Can be used in critiera such as <8 , !=12 etc
Special Expressions
  • BETWEEN(lower,upper): Using BETWEEN(10,20) will match from 11 to 19
  • IN(a,b,c..): Using IN(10,11,21,30) will match the supplied list of numbers
  • NOT(a,b,c..): Using NOT(10,11,21,30) will match everthing other than the supplied list of numbers
Compound expressions

Complex expressions such as the one below can also be used

  • >8 && (!=12 && !=13): Match all numbers that is great than 8 and is not 12 and 13

Example

COUNTIF(A1:A10, ">20") → Counts cells in range A1:A10 with values greater than 20
COUNTIF(B1:B10, "Completed") → Counts cells in range B1:B10 that contain "Completed"
COUNTIF(C@CURRDOC!A1, "BETWEEN(9,21)") -> Counts cell in children's A1 that contain values from 10 to 20
COUNTIF(C1:C10, "IN(0,1,8)") -> Counts cells in range C1:C10 that have either 0 or 1 or 8
COUNTIF(C@CURRDOC!A10, ">8 && !=12" ) -> Counts cells in range children's A10 that contain values greater than 8 and is not 12