Catalog

How to Use the COUNTIF Function in Google Sheets ?

January 16, 2024 1.3K views

Introducing the COUNTIF Function

Analyzing a large dataset containing lots of rows and functions with Google Sheets can be an arduous task. If you don’t have a lot of free time and don’t want to go through the process manually, you will need to apply a function instead of a formula to get the analysis done easily.

The countif google sheets function is the best way to perform analysis effectively. This function allows you to count cells from a specific cell range. In simple words:

“COUNTIF Google Sheets function allows you to count how many cells are present in a cell range, provided that they satisfy a predefined condition.”

Using this function, it will become easier for you to find how many batches of cells in a given column follow the criterion you are going to check. By default, this function helps you find specific cells that are exact matches. But you can tweak the function to run different types of commands.

Syntax of the COUNTIF Function

The google sheets countifs function can be broken down into two parts. Firstly, the COUNT part is used to count the number of cells in a specific range. The IF part is in place to find out if the given range meets the specific criteria in cells/data or not.

The basic syntax of the COUNTIF function is as follows:

=COUNTIF(range, criterion)

In this formula, the given range and criterion is the value that the user provides, called the parameter in this case. The range in what is tested against the criterion, and criterion is the given pattern that is applied to the given range.

Scenarios and Corresponding Examples Using the COUNTIF Function

Understanding the google sheets countif function can become easier if you explore its use cases. First off, we can start with a given scenario in which we are given sales data. Our purpose is to find how many times the sales are above or below a certain range.

For example, we can find instances where the sales are above $400. We start by putting in the data in our sheet:

After we are done with launching our sheet and entering the data, we will proceed to enter the formula of the COUNTIF function in the sheet. We will enter this specific formula:

=COUNTIF(B2:B10,">400")

This formula shows us how the given range is from B2 to B10. You can take the range all the way to the 10000th time if needed. Once you enter the formula, Google Sheets will return the value as per the given condition.

The results will be like this:

This formulation can be changed for the next three ranges through the formula. The given formulas are entered as:

=COUNTIF(B2:B10,"200")

=COUNTIF(B2:B10,"

By entering all four formulas in the sheet, we are presented with the following result:

This example shows how COUNTIF function can be used for filtering statistical data according to a set of defined ranges. In real scenarios, this function holds up pretty good for solving problems that involve the filtering of data. Some of the examples are:

  • Finding out the number of students who received below or above a certain range.

  • Understanding the shopping behavior of customers based on their buying budget.

  • Pointing out the number of people who hold a major contribution to a given fund.

The usage of this function is not limited to numbers only. With this feature, you can also find out the instances in which a text reappears. For example, if you are going to run data analysis to find the number of people who have the same name in an organization, you can use this function to save time and effort.

Combination of COUNTIF Function and Other Functions

As mentioned above, there are unlimited use cases for using the COUNTIF function in google sheets. It can be used to handle several other types of real-world scenarios. Here's a quick overview of the important uses of the COUNTIF function in commonly popping-up scenarios:

Use Wildcards

In some circumstances, you might want to find the words that might appear in given cells. You don’t need to use the “Search” tab to find such words, as the Search feature can take a lot of time if you are dealing with a large dataset.

The simplest way you can save your time and find the values effortlessly is by using the COUNTIF feature that contains the Wildcard option. Here is an example:

We have entered the name of the category in Column D, and Column E contains the output of the function we are going to use. Here is the syntax of the function we use:

=COUNTIF(A2:A10,"*Bottles*")

Here is what the process looks like:

This is the result we get by using the formula:

You can see that using the wildcard feature allows us to find the instances of text that might be present in a given range.

The best thing about the wildcard feature is that it is not case-sensitive. For example, in the scenario mentioned above, there will be no change of the final result even if the word “Bottles” is not capitalized in certain cells. Here is the proof:

Pay attention to the fact that there are interchanging lowercase and uppercase instances of the word “Bottles” in the given data. You can also see that we are using the same formula as we used above.

But the surprising thing is that there is no effect on the results produced. The wildcard scenario of COUNTIF function is able to find the values without running into any problems. This functionality can be extremely useful in real-world cases when we deal with a large dataset that might contain varying values.

You can make several changes to the search phrase you enter as a criterion in the COUNTIF function. For example, if you are looking to find words that contain certain characters, you can use the “*” sign to find out the values that have the same characters.

In this example, we want to look for the words that contain “es” in cells. We will use the following formula:

=COUNTIF(A2:A10,"*es")

Entering this formula will present:

You can see that by using “*es” as criterion of the COUNTIF function, Google Sheets return all the characters that contain es in them. In our case, there are exactly five cells containing es in our specific data.

Common Problems and Solutions

Using the COUNTIF feature might not be easy if you are starting to use electronic spreadsheets for the first time. There is no denying that using this feature is also a bit difficult as it includes both a condition and a range, which can be difficult to find out sometimes.

Here are a couple of problems many people face when using the COUNTIF function:

Q. The COUNTIF function Does Not Work Properly.

Using the COUNTIF function contains two basic parts:

  • A condition.

  • A given range.

Keep in mind that you won’t be able to find out the required answers from the sheet if you don’t provide any of those values properly. If you run into this problem, make sure you check the combination of the COUNTIF feature carefully to fix any problems you face.

Q. There is a Data Type Mismatch Issue in My Data.

As given above, using the COUNTIF feature properly is possible only if you type the syntax the right way. If you are unable to provide the condition and the criterion, you won’t be able to find results that don’t contain mismatches. Make sure you double-check the formula you’re using to get the right results. Also, confirm that google sheets countif not blank is valid.

How to Use the COUNTIF Function in WPS Office

If you are using an offline suite like MS Office to use the COUNTIF function, then you can follow all the tips mentioned above to perform calculations online. A great way you can apply the COUNTIF function offline without running into problems is by using WPS Office.

The good thing about WPS Office is that it is super convenient to use even if you are a newbie. Another great thing about WPS Office is that you can find a ton of additional guides for using this software, so you can overcome any problem you face.

WPS Office is a go-to choice for more than 500 million users worldwide. The reason why people trust it is that it is free, and you can start using it without using your credit/debit card. Another great thing is that it also is compatible with all the other document formats like:

You can use WPS Office to create, edit, and share files in all leading formats, and the software is also compatible with all leading operating systems. Download WPS Office to use COUNTIF and other great functions on data.


15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.