All in One Bundle

COUNTIF Function In Google Sheets

Written by ExcelMojo Team ExcelMojo Editorial Team Editorial Team The ExcelMojo Editorial Team creates and improves practical Excel, VBA, Power BI, analytics, and AI spreadsheet resources for learners, analysts, teams, and business professionals. Excel VBA Power BI View Full Bio
Reviewed by Dheeraj Vaidya, CFA, FRM Dheeraj Vaidya, CFA, FRM Co-Founder & Course Director Dheeraj is the founder of ExcelMojo and leads the learning direction across Excel, analytics, financial modeling, valuation, and AI spreadsheet workflows. A former J.P. Morgan and CLSA equity... Financial Modeling Valuation Investment Banking View Full Bio
Updated Apr 23, 2026
Read Time 7 min

What Is COUNTIF Function In Google Sheets?

COUNTIF function in Google sheets is an inbuilt function used to count the data with specific criterions. It is a formula categorized under COUNT functions and as the name suggests, COUNTIF function counts the number of values or entries in the data with conditions. COUNTIF function in Google sheets helps users by counting specific entries. It is useful when we have to work with huge datasets.

For example, consider the below table showing names and marks in columns A and B respectively.

Download FREE COUNTIF Function In Google Sheets Template and Follow Along!

Use this COUNTIF Function In Google Sheets Template to follow along with the examples in this article.

Download Excel Template

COUNTIF-Function-In-Google-Sheets-Definition

Now, let us count the values with the data ‘Andy’ in the cell range.

To begin with, insert the data in the spreadsheet. In this example, the data is available in the cell range A1:B8. Now, select the cell where we want to insert the formula. In this example, it is cell B11. Next, insert the COUNTIF function formula in cell. So, the complete formula is =COUNTIF(A2:B8,A8). Press Enter key.

We will be able to see the result in cell as shown in the below image.

COUNTIF-Function-In-Google-Sheets-Definition-Step-3

Likewise, we can use the COUNTIF formula in Google sheets.

In this article, let us learn more about COUNTIF function in Google sheets with detailed examples.

Key Takeaways

  • COUNTIF function in Google sheets is a default function used to count the number of values with conditions.
  • While working with huge datasets, we can use COUNTIF function to find values with specific entries.
  • The syntax of COUNTIF function in Google sheets is =COUNTIF(range,criterion) where
    • Range is the mandatory argument showing the cell range where we want to count the value
    • Criterion is the condition with which we want to filter and count the value in the data.
  • Remember, both the arguments are mandatory and we can use as many conditions we want with the formula.

COUNTIF() In Google Sheets Formula

Formula

The syntax of formula of COUNTIF function in Google sheets is =COUNTIF(range,criterion)

where

  1. Range is the cell range where we want to count the value
  2. Criterion is the condition or conditions with which we want to filter and count the value in the data.
  3. Both the arguments are mandatory.

How To Use COUNTIF Function In Google Sheets?

Let us learn how to use COUNTIF function in Google sheets with the help of the following steps.

Step 1: To begin with, insert the data in the spreadsheet. Now, select the cell where we want to insert the formula.

Step 2: Next, insert the COUNTIF function formula in cell.

Step 3: Press Enter key.

We will be able to see the result in the active cell.

Likewise, we can use the COUNTIF formula in Google sheets.

Examples

Now, let us learn how to use COUNTIF function in Google sheets with detailed examples.

Example #1 – Using Google Sheets COUNTIF To Count Non-Blank Cells

For example, consider the below table showing product and sales in columns A and B respectively.

COUNTIF-Function-In-Google-Sheets-Example-1

Now, let us count the values with blank cells and non-blank cells in the cell range.

The steps are:

Step 1: To begin with, insert the data in the spreadsheet. In this example, the data is available in the cell range A1:B10. Now, select the cell where we want to insert the formula. In this example, we need to count non-blank cells in cell B13, and non-blank cells in cell B14.

Step 2: Next, insert the COUNTIF function formula in cell B13.

Example-1-Step-2

So, the complete formula is =COUNTIF(A2:A10,”<>”)

Step 3: Press Enter key.

We will be able to see the result in cell as shown in the below image.

Example-1-Step-3

Now, let us count the blank cells in cell B14.

The steps are:

Step 1: Select cell B14 and enter the COUNTIF formula in Google sheets.

So, the complete formula is =COUNTIF(A2:A10,””)

Example-1-Step-1

Step 3: Press Enter key.

We will be able to see the result in cell as shown in the below image.

Example-1-Step-3-1

Likewise, we can use the COUNTIF formula in Google sheets to count blank and non-blank cells.

Example #2 – Using Google Sheets To COUNTIF To Count Cells With Text And Numbers (Exact Match)

For example, consider the below table showing product and quantity (in Kg) in columns A and B respectively.

COUNTIF-Function-In-Google-Sheets-Example-2

Now, let us count the values with the data ‘Apple’.

The steps are:

Step 1: To begin with, insert the data in the spreadsheet. In this example, the data is available in the cell range A1:B10. Now, select the cell where we want to insert the formula. In this example, it is cell B13.

Step 2: Next, insert the COUNTIF function formula in cell.

So, the complete formula is =COUNTIF(A2:B10,”Apple”)

Example-2-Step-2

Step 3: Press Enter key.

We will be able to see the result in cell as shown in the below image.

Example-2-Step-3

Likewise, we can use the COUNTIF formula in Google sheets.

Example #3 – Count In Google Sheets With Multiple Criteria – AND Logic

For example, consider the below table showing region, product and unit in columns A, B and C respectively.

COUNTIF-Function-In-Google-Sheets-Example-3

Now, let us count the values with the data ‘North’ and ‘Laptop’ using AND Logic.

The steps are:

Step 1: To begin with, insert the data in the spreadsheet. In this example, the data is available in the cell range A1:C10. Now, select the cell where we want to insert the formula. In this example, it is cell C13.

Step 2: Next, insert the COUNTIF function formula in cell.

So, the complete formula is =COUNTIFS(A2:A10,”North”,B2:B10,”Laptop”)

Example-3-Step-2

Step 3: Press Enter key.

We will be able to see the result in cell as shown in the below image.

Example-3-Step-3

Likewise, we can use the COUNTIF formula in Google sheets with AND logic.

Example #4 – Count In Google Sheets With Multiple Criteria – OR Logic

Now, let us use the same example we used in Example #3. Consider the below table showing region, product and unit in columns A, B and C respectively.

COUNTIF-Function-In-Google-Sheets-Example-4

Now, let us count the values with the data ‘North’ and ‘Laptop’.

The steps are:

Step 1: To begin with, insert the data in the spreadsheet. In this example, the data is available in the cell range A1:C10. Now, select the cell where we want to insert the formula. In this example, it is cell C13.

Step 2: Next, insert the COUNTIF function formula in cell.

So, the complete formula is =COUNTIFS(A2:A10,”North”)+COUNTIF(B2:B10,”Laptop”)

Example-4-Step-2

Step 3: Press Enter key.

We will be able to see the result in cell as shown in the below image.

Example-4-Step-3

Likewise, we can use the COUNTIF formula in Google sheets with OR logic.

Important Things To Note

  1. COUNTIF function is a formula in Google sheets grouped under the COUNT functions.
  2. The COUNTIF function is used to count the values in the data with condition or criteria.
  3. We need to enter the correct logical operator to find the count of values with blank, non-blank, and blank with text data.

Frequently Asked Questions (FAQs)

1. Explain COUNTIF function in Google sheets with an example.

For example, consider the below table showing subjects and the number of students in columns A and B respectively.
FAQ-1
Now, let us count the values with the data ‘Physics’ in the given cell range.
The steps are:
Step 1: To begin with, insert the data in the spreadsheet. In this example, the data is available in the cell range A1:B8. Now, select the cell where we want to insert the formula. In this example, it is cell B11.
Step 2: Next, insert the COUNTIF function formula in cell.
So, the complete formula is =COUNTIF(A2:B8,”Physics”)
Step 3: Press Enter key.
We will be able to see the result in cell as shown in the below image.
FAQ-1-Step-3
Likewise, we can use the COUNTIF formula in Google sheets.

2. What are the logical operators we can sue while using COUNTIF function in Google sheets?

While using COUNTIF function in Google sheets, we can use the following logical operators.
They are:
• “<>” For non-blank cells
• “” for blank cells
• “*” for non-blank text values

3. Why COUNTIF is not working?

COUNTIF Function in Google sheets may not work when we don’t include the correct cell range or logical operator. Users must remember to add the correct logical operator for blank or non-blank cells and also, to include ‘+’ or a comma to use the COUNTIF function with AND or OR function in Google sheets.

Download FREE COUNTIF Function In Google Sheets Template and Follow Along!

Use this COUNTIF Function In Google Sheets Template to follow along with the examples in this article.

Download Excel Template