If you need to count the number of rows corresponding to a name or a product, there is better than to use the filter. In fact, the COUNTIF function is dedicated for this.
But the function COUNTIF accepts only one criteria of selection. If you want to count your row for more than one criteria, it's better for you to use the function COUNTIFS.
Presentation of COUNTIF
The function COUNTIF requires only two parameters
- the range of cells where is your data
- the value you search (the criterion).
=COUNTIF(Range of cells, criteria of selection)
For instance, you can use the cell B3 where its value is CD-Rom
It is imperative that the value you look for is always the same. In this example, the second word "CD-Rom" begins with a space (so it's not exactly the same word). This is why, in this example, the formula returns only 3 times the word "CD-Rom".
On the other hand, the COUNTIF function ignores sensitive case
COUNTIF with greater than / smaller than
If you want to count the number of elements larger (or smaller) than a certain value, just as the second parameter to write a logical test (such as >100, >=100, <50, ...)
For all logical tests and how to use it, see this article.
=COUNTIF(C3: C12, ">=80")
As you can see, the test is between double-quote like a text. Why ? 🤔🤨😕
Well, previously we don't put any logical symbol in our formula. But you can also write the same formula with the symbol = like this
So, for any test in a function COUNTIF, you write it between double-quote.