The COUTIF Google Sheets function can be used when you want to get the count when a given condition is met. COUNTIF contains the Google Sheets COUNT function and the IF function.
For example, if you have a list of students and want to quickly get the count of all the students that scored above 75, then you can use the COUNTIF Function in Google Sheets.
Before I show you some cool examples of using the COUNTIF Function, let’s quickly go through the syntax and some important things about it.
SYNTAX of the COUNTIF Function in Google Sheets
=COUNTIF(range, criterion)
 range – the range of cells from which you want to get the count.
 criterion – the condition that should be met for a cell to be counted.
The criterion could be:
 a number.
 a text string, such as “Apple” or “Banana”.
 a cell reference (such as A1 or B1).
 an expression such as “=100” or “>100” or “<100”. Note that in the case of equal to, you are not required to use the equal to sign. You can simply use the number in double quotes.
The range of cells could contain numbers or text strings.
 If the range contains numbers, then the criteria could use comparison operators (>, <, =, <>). For example, to count the number of students who scored above 75 in a subject, you can use “>75” as the criterion. The function would check each number in the ‘range’ for this criterion. Note that when you use an operator with a number, you need to enclose it in double quotes.
 If the range contains text strings, the criteria can be the text string within double quotes (e.g., “Apple”) or can be a cell reference that contains the text string.
 You can also use wildcard characters in case of text criterion. For example, to count cells that contain Apple or Apples, you can use Apple* as the criterion.
What Does the COUNTIF Google Sheets Function Do?
The COUNTIF function Google Sheets is used to count the number of times a criterion has been met in a range of cells. It looks for the exact matches of the criteria in the range of data and returns how many exact matches it finds.
How to Use the COUNTIF Google Sheets Function
The COUNTIF function only has two arguments. Therefore, it can only be used with one criteria. The criteria can be a cell reference, a text string in quotation marks, or a wildcard character.
You can use the function to let Google spreadsheet count the number of cells with text by using empty quotation marks in the criteria.
You can also use operators in the criteria of the COUNTIF formula like > (greater than), < (less than), <> (not equal to), and = (equal to).
For example, you can count the numbers greater than 50 using the criteria >50.
Now let’s have a look at some COUNTIF formula examples in Google Sheets.
COUNTIF Google Sheets Function Examples
Here are six examples of using COUNTIF in Google Sheets.
Example 1 – Counting the Number of Students with More than 75 Marks
Suppose you have a list of students with the marks scored on a test.
Here is the formula that will give you the count of students who scores above 75.
=COUNTIF($B$2:$B$14,”>75″)
Note:
 The condition needs to be within double quotes.
 You can also have the criterion value in a cell and use that cell reference. For example, if the criterion is in cell C2, then you can use the formula: =COUNTIF($B$2:$B$14,”>”&C2). When you use a cell reference, you still need to have the operator in double quotes and use & to join it with the cell reference.
Example 2 – How to Count Text Values in Google Sheets for Transaction Accounts
Suppose you have the transaction data as shown below:
Here is the formula that will give us the number of transactions for the US:
Note:
 Since the criterion is text, there is no need to use the equal to sign. For example, in this example, the condition is that the country should be equal to the US, so you can simply use “US”.
 You can also have the criterion in a cell. In that case, you can simply use the cell reference. For example, if the criterion is in cell D2, you can use the formula: =COUNTIF($B$2:$B$13,D2)
Example 3 – Counting All the Records Except US with a Google Sheet COUNTIF Function
Suppose you have the same transaction data (used in example 3) and you want to count all the transaction records except for those of the US.
Here is the formula that will do this:
=COUNTIF($B$2:$B$13,”<>US”)
The above formula would count all the transactions except the ones where the country is ‘US’.
Example 4 – Counting with Wildcard Characters
Wildcard characters include an asterisk(*) for whole words and a question mark (?) for a single character. For example, in our sheet below, we can count all the values with the word Apple in them.
To count the number of values that have the word apple in them, we have used the formula =COUNTIF(A2:A10, “Apple*”)
We have the asterisk after the word Apple since all the values with the word Apple have it as the first word.
Example 5 Counting All Empty/Blank Cells in a Range with the COUNTIF Function Google Sheets Syntax
If you have a huge dataset and you want to get a count of missing records or empty or blank cells, you can use the Google spreadsheet COUNTIF functions to do this.
Suppose you have a dataset as shown below:
Here is the formula that will give you the total number of empty or blank cells in it:
=COUNTIF($C$2:$C$13,””)
In this example, the criteria used is ” ” (double quotes). When only double quotes are used as criteria, it counts only those cells that are empty/blank. Note that if there is a cell that looks blank but has a space character in it, then it will not be counted by this formula.
Example 6 – Counting All Nonblank Cells in a Range with the Google Sheets COUNTIF Function
You can use the function to make Google Sheets COUNTIF cell contains text. Taking the same data from example 4, in this example, let’s see how to count all the nonblank cells in the dataset.
Here is the formula that will count all the nonblank cells:
=COUNTIF($C$2:$C$13,”<>”)
In this example, the criteria used is “<>” (not equal to a sign within double quotes). This criterion means that the cells are not equal to an empty string. This lets Google Sheet count the number of cells with text and returns that number. Note that if there is a cell that looks blank but has a space character in it, then it will be counted by this formula.
Example 7 Count Cells Based on the Date
Using COUNTIF to count values based on dates works the same as with texts or strings. You have to enclose the date in quotation marks or use a cell reference instead.
If not, you can also use DATE( )
For example, in our sheet below, we can count the number of values with dates before 20th Feb, 2023 using the formula
=COUNTIF(A2:A14,”<2/20/2023″)
If you were to use the DATE function instead, then it needs to be in the format YYYY/MM/DD. You should not use quotations in this case. You can also combine the COUNTIF function with date functions like TODAY if you want to count the days until or after the current day in the data range.
In our example sheet, we would use the formula:
=COUNTIF(A2:A14,”<=”&TODAY())
to count the dates before the current date.
Example 8 – Count All Instances where a Keyword Appears
Sometimes, you may have to deal with data that contains variations of the same name or item. For example, in the data below, there are variations of Apple as Apple, Apples, Fruit – Apple.
Here is the formula you can use to count the total number of cells with the keyword Apple:
=COUNTIF($A$2:$A$13,”*Apple*”)
In the above example, the criterion used is *Apple*. An asterisk (*) is a wildcard character representing any number of characters. So *Apple* would count any cell that has the text Apple in it, and it could be flanked by any number of characters on either side.
Using COUNTIFS Function in Google Sheets
The COUNTIF and Google Sheets COUNTIFS function works similarly. However, COUNTIFS allows you to select more than one criteria to check against before counting. The syntax for COUNTIFS goes as follows:
= COUNTIFS (criteria_range1, condition1,[ criteria_range2, condition2,…])
As you can see, it’s exactly the same as COUNTIF but with additional critera_range(s) and conditions. You can add as many as you’d like. Let’s take a look at an example to see how it works.
In the below example, we need to see if the people in the data set have brown eyes, and brown hair and tested positive for a genetic condition.
We used a COUNTIFS formula with multiple criteria to check against each requirement to return a result of 1.
COUNTIF Formula Google Sheets Tips and Troubleshooting
 The COUNTIF formula can only use one criteria; use COUNTIFS for multiple criteria
 Text arguments aren’t case sensitive
 Don’t forget to use quotes on text strings and logical operators
How to Use COUNTIF in Google Sheets FAQ
How Do You COUNTIF a Range of Numbers in Google Sheets
 Type =COUNTIF( into an empty cell you wish to show the results in
 Highlight the range you wish to count, then type a comma,
 Type the criteria to be checked
 Press enter
Can You Do a COUNTIF With Multiple Criteria Google Sheets?
No, you have to use the COUNTIFS formula instead. It works the same as COUNTIF but allows for multiple criteria.
What Is the Criteria in COUNTIF?
You can picture the criteria as the IF statement you want to check against. For example, if you wanted to count how many people scored over 80 on a test, your criteria could be “>80” It can also help Google Sheets count cells with text by using empty quotation marks.
How Do You Do a COUNTIF With Two Criteria Sheets?
You have to use COUNTIFS instead with the following syntax:
= COUNTIFS (criteria_range1, condition1,[ criteria_range2, condition2,…])
Wrapping Up
In this article, we have shown you how to use the COUNTIF Google Sheets function to count the number of values that match the criteria. We have also shown you the Google Sheets counting cells with text method using “<>” (not equal to sign within double quotes) as the criteria, you can substitute that operator for any other Google Sheets compatible operator too.
If you found this article useful, then check out how to count number words in Google Sheets.
Related:
Sumit is a Google Sheets and Microsoft Excel Expert. He provides spreadsheet training to corporates and has been awarded the prestigious Excel MVP award by Microsoft for his contributions in sharing his Excel knowledge and helping people.

Sumithttps://productivityspot.com/author/sumitbansal23/

Sumithttps://productivityspot.com/author/sumitbansal23/

Sumithttps://productivityspot.com/author/sumitbansal23/

Sumithttps://productivityspot.com/author/sumitbansal23/
2 thoughts on “A Smooth StepByStep COUNTIF Google Sheets Guide”
What if I wanted the “countif” function to count Apples even if it said Green Apples or Red Apples as well as if it said Apple or Apples? I notice that the Apple* function only works if it STARTS with apples, but I want it to count the cell even if apples APPEARS ANYWHERE. How do I do that?
*apple*
Comments are closed.