Google Sheets COUNTIF Function
COUNTIF Function
The COUNTIF function is a premade function in Google Sheets, which counts cells that match a specified condition.
It is typed =COUNTIF
and has two parts:
=COUNTIF(range, criterion)
The condition is referred to as criterion
, which can check things like:
- If a number is greater than another number
>
- If a number is smaller than another number
<
- If a number or text is equal to something
=
Countif Function Example
Apply the COUNTIF
function to range B2:B21
, to count how many Pokemons there are of Fighting, Water and Grass types:
COUNTIF function, step by step:
- Select the cell
G4
- Type
=COUNTIF
- Click the COUNTIF command
- Specify the range
B2:B21
for the Type 1 values - Type
,
- Specify the criteria (the cell
F4
, which as the value "Fighting") - Hit enter
The function now counts the number of Fighting type Pokemon.
The function can be repeated for Water and Grass type Pokemon compare them:
Note: You can use the filling function for the other rows, but make sure to use absolute references for the ranges.
Now, we can see the number of Fighting, Water and Grass type Pokemon from this list: