Count cells that match criteria
=COUNTIF(range, criteria)
| Parameter | Description |
|---|---|
range |
The range of cells to count. |
criteria |
The criteria that controls which cells should be counted. |
The generic syntax for COUNTIF looks like this:
=COUNTIF(range,criteria)
The criteria is applied to cells in the range. When cells meet the criteria, they are added to the count. In the worksheet below, we have a small amou
=COUNTIF(D5:D16,">100") // count sales over 100
=COUNTIF(B5:B16,"jim") // count sales by Jim
=COUNTIF(C5:C16,"CA") // count sales in CA
A great way to use COUNTIF is to put criteria in another cell and then refer to this cell inside your formula. This makes it easy to change criteria l
=COUNTIF(range,A1)
If you need to include an operator in the criteria, you must concatenate the cell reference to the operator. For example, to count cells that are grea
=COUNTIF(range,">"&A1)
Note we are joining the ">" operator to cell A1 with an ampersand (&) character. In the worksheet below, COUNTIF has been configured to return the cou
=COUNTIF(D5:D16,">"&F5) // count if greater than G4
=COUNTIF(B5:B9,"<>red") // not equal to "red"
=COUNTIF(B5:B9,"<>blue") // not equal to "blue"
=COUNTIF(B5:B9,"<>"&E7) // not equal to E7