COUNTIF function is one of the most basic & simple operations in MS Excel that can be used to count 0(Zero), greater than 0 or less than 0 under lots of criteria from multiple columns. In this article, I’ll try to guide you through the proper illustrations how we can utilize this COUNTIF function precisely to determine the range of cells containing numbers greater than 0(Zero).
Download Practice Workbook
You can download the Excel Workbook that we’ve used to prepare this article. You can change the values, formulas or input data in the blank cells to find out your own results.
Introduction to COUNTIF
- Formula Syntax:
range- Range of cells to be selected
criteria- Criteria of the cells that needs to be assigned
Counts the number of cells within the range that meet the given condition.
In the picture below, a list of color names is given. If we want to know how many times Red is there then we have to type in the output cell-
After pressing Enter, we’ll see there are 4 instances of Red in the list.
1. Counting Cells Greater Than 0 (Zero) with COUNTIF
Now, here’s our dataset with goals & assists in 15 matches of a footballer in a season. He has not played 2 matches (Match 6 & 9) and the cells are blank there. We want to count how many goals he has scored.
➤ Select output Cell F13 & type-
➤ Press Enter & you’ll find the total of 9 matches he has scored.
Keep in mind, while inputting the criteria for greater or less than a number in COUNTIF function, you have to put it between Double-Quotes(“…“).
2. Using COUNTIF along with Ampersand(&) to Count Cells Greater than 0(Zero)
We can also type our criteria for greater than zero by using Ampersand(&). As we’re now going to find how many matches the player has provided assists to the goal, we have to consider Column D now.
➤ Type in Cell F13–
➤ Press Enter & you’ll see the footballer has assisted in 8 isntances out of 15 matches.
Here, we’re using Ampersand(&) after Double-Quotes to join “Greater Than” criteria with 0.
3. Counting Cells Greater Than or Equal to 0(Zero) with COUNTIF
Now we want to count cells containing numbers greater than 0. In our dataset, we can apply it to count the number of matches the footballer has played.
➤ In Cell E13, we have to type-
➤ Then press Enter & we’ll see the player has played total of 13 matches as there are two blank cells in our dataset which have not been counted.
- COUNTIF Date Is within 7 Days
- COUNTIF Between Two Dates in Excel
- COUNTIF Excel Example (22 Examples)
- How to Use COUNTIF with WEEKDAY in Excel
4. Counting Cells Greater Than 0(Zero) And Less Than Another Number with COUNTIF
Here’s another case where we want to find a number greater than 0 but less than 2. For our dataset, we can use this logic to count the number of matches the player has scored only 1 goal.
➤ In Cell F13, we have to type-
=COUNTIF(C5:C19,">0") - COUNTIF(C5:C19,">=2")
➤ Press Enter & you’ll notice 5 matches the player has scored only 1 goal.
🔎 How Does The Formula Work?
➤ First of all, we’re finding out how many matches he has scored & it’s 9 in total.
➤ Then We’re determining the number of matches he has scored 2 or more goals & the number is 4.
➤ After subtracting the resultant value of 2nd criteria from the 1st one, we’ll get the total number of matches he has scored exactly 1 goal.
5. Counting Cells Greater Than 0(Zero) with COUNTIFS under Multiple ‘AND’ Criteria From Different Columns
If we want to add more than one criteria while counting cells greater than 0, then we have to use COUNTIFS function where multiple criteria can be added easily. So, now we want to know how many matches the footballer has scored goals as well as provided assists.
➤ In Cell F13, type-
➤ Press Enter & you’ll see the player has contributed in both goals & assists 7 times out of 15 matches.
To add multiple criteria, we have to simply use Comma(,) to separate two criteria.
6. Counting Cells Greater Than 0(Zero) by Combining COUNTIF & COUNTIFS under Multiple ‘OR’ Criteria From Different Columns
And in our last example, we’ll use COUNTIF along with COUNTIFS functions together. This time we’re going to find the number of matches where the player has either scored goals or provided assists.
➤ In Cell F13, the formula for our criteria will be-
=COUNTIF(C5:C19,">0") + COUNTIF(D5:D19,">0") - COUNTIFS(C5:C19,">0",D5:D19,">0")
➤ Now press Enter & you’re done.
So, in total of 10 matches, the footballer has either scored goals or provided assists out of 15 instances.
🔎 How Does The Formula Work?
➤ By using Plus(+) between two COUNTIF functions, we’re separately determining the number of matches the player has scored goals & provided assists. So, here the return value will be- 9+8=17
➤ After that, COUNTIFS function will find out how many matches the player has both scored goals & provided assists. Here the resultant count is 7.
➤ By subtracting the resultant value found through the previous step from that of 1st step, the final output will be 10 (17-7=10).
I hope I’ve covered all possible criteria & methods we can use COUNTIF as well as COUNTIFS functions to count the cells greater than 0 in this article. If you think I’ve missed one that should’ve been added too then please let me know in the comment section. You can also have a look at our other interesting & informative articles related to Excel functions on this website.