Excel COUNTIF Function to Count Cells Greater Than 0

Introduction to the COUNTIF Function

• Syntax

`COUNTIF(range, criteria)`

• Arguments

range: Range of cells to be selected.

criteria: Criteria of the cells that need to be assigned.

• Function

Counts the number of cells within the range that meet the given condition.

• Example

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-

`=COUNTIF(B2:B11,"Red")`

After pressing Enter, we’ll see there are 4 instances of Red in the list.

6 Examples of COUNTIF Function to Count Greater Than 0 (Zero)

Example 1 – Count Cells Greater Than 0 (Zero) with COUNTIF

We have a dataset of goals and assists in 15 matches of a footballer in a season. He has not played 2 matches (Matches 6 and 9) and the cells are blank there. We want to count how many goals he has scored.

Steps:

• Select output Cell F13 and insert:
`=COUNTIF(C5:C19,">0")`
• Press Enter.

NOTE: Keep in mind, while inputting the criteria for greater or less than a number in the COUNTIF function, you have to put it between Double-Quotes(““).

Example 2 – Add Ampersand (&) with the COUNTIF Function to Count Cells Greater than 0 (Zero)

Steps:

• Use the following formula in Cell F13:
`=COUNTIF(D5:D19,">"&0)`
• Press Enter.

We’re using Ampersand(&) after Double-Quotes to join the “Greater Than” criteria with 0.

Steps:

• In Cell E13, use:
`=COUNTIF(C5:C19,">=0")`
• Press Enter.

Example 4 – And Less Than Another Number with COUNTIF to Count Greater Than 0 (Zero)

We want to find the number of values greater than 0 but less than 2.

Steps:

• In Cell F13, use
`=COUNTIF(C5:C19,">0") - COUNTIF(C5:C19,"<=2")`
• Press Enter.

Example 5 – Utilize the COUNTIFS Function under Multiple AND Criteria from Different Columns

We want to know how many matches the footballer has scored goals as well as provided assists.

Steps:

• In Cell F13, use
`=COUNTIFS(C5:C19,">0",D5:D19,">0")`
• Press Enter.

NOTE: To add multiple criteria, use a Comma(,) to separate two criteria.

Example 6 – Combine COUNTIF and COUNTIFS Functions under Multiple OR Criteria from Different Columns

We’re going to find the number of matches where the player has either scored goals or provided assists.

Steps:

• In Cell F13, the formula is:

`=COUNTIF(C5:C19,">0") + COUNTIF(D5:D19,">0") - COUNTIFS(C5:C19,">0",D5:D19,">0")`

• Hit Enter.

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. The 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).

Related Articles

Get FREE Advanced Excel Exercises with Solutions!

NEHAD ULFAT is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET but switched gears, working as a content developer.  In this role, he creates techy content all about Excel... Read Full Bio

1. There are a load of numbers in my cells and I just get 0.

• Thank you, Dan, for your comment. If the values are in text format, then the COUNTIF function will return zero. You can see that we have used a IF formula, which returns TRUE when the value from column B is greater than five. Notice the output is in text format.

• Now, if we want to count the number of FALSE in the column C, it will return zero.

• There are two solutions for this issue. Firstly, you can add asterisks (*) with the criteria.

• Another way is to change the formula in column C to return TRUE or FALSE as Boolean values.

• Then, the COUNTIF function will return the correct value.

However, if this doesn’t solve your problem, you can mail us your Excel file to: [email protected], and we’ll try to solve it as soon as possible.

Advanced Excel Exercises with Solutions PDF