In Excel, the CountIf function counts the number of cells in a range, that meets a given criteria.
The syntax for the CountIf function is:
CountIf( range, criteria )
range is the range of cells that you want to count based on the criteria .
criteria is used to determine which cells to count.
Examples:
Based on this table:
|
A |
B |
C |
1 |
Age |
Value |
|
2 |
10 |
25 |
56 |
3 |
21 |
50 |
|
4 |
34 |
55 |
|
5 |
56 |
78 |
|
6 |
56 |
10 |
We are only counting the cells if they contain the value we are looking for.
=CountIf(A2:A6, C2) |
would return 2 |
=CountIf(A:A, C2) |
would return 2 |
=CountIf(B2:B6, “>=50”) |
would return 3 |
Countif – Excel Function