A basic task with Excel is to count the number of rows for a specific criteria.
Solution with the filter
Most of the Excel users, use the filter to count the rows.
But this solution is really not convenient when you have to repeat this action for many values.
The solution is to use COUNTIF or COUNTIFS
Presentation of COUNTIF
The function COUNTIF counts the number of rows for one criteria.
The function requires only two arguments
- The range of cells where is your data
- The value you search (the criterion).
=COUNTIF(Range of cells, criteria of selection)
Example with COUNTIF
You want to know how many times you have sold Banana.
To return the number of time you have the name Banana in your list, you have to write the formula like this
And the result is
Replace the criteria by a cell reference
Now if instead of typing the name of the data you want to have the reference of a cell where its value = the name you want
For instance, you can use the cell B3 where its value is CD-Rom
Not sensitive case
Don't worry if your criteria hasn't the same case of the data in your table, the function COUNTIF, is not sensitive case.
For instance, in this example, we want to count the number of times we have the word PEACH in uppercase and the result is
More than one criteria
If you need to count rows with more than one criteria you must use function COUNTIFS
It isn't more complex but you just have to write more arguments 😉