# How to Use a COUNTIF Function in Google Sheets

Last Updated on April 14, 2023 by Jake Sheridan

In this tutorial, you will learn how to use a COUNTIF function in Google Sheets.

## How to Use a COUNTIF Function in Google Sheets

The COUNTIF function in Google Sheets is a powerful tool for counting values in a dataset based on a set of criteria.

For example, you may want to count the number of times a certain value appears in your data, or count the number of times a value falls within a certain range.

In this guide, we will show you how to use the COUNTIF function in Google Sheets.

## How to Count Cells Based on a Specific Criteria in Google Sheets

Here’s how to count cells based on a specific criteria in Google Sheets.

### Step 1

First, determine what range you’ll be counting and what criteria should be the basis for including cells in the count.

In this example, we want to count all instances of a particular shirt size in column A. This will give us an idea of the shirt size distribution from our table of orders.

### Step 2

Type the COUNTIF function and enter the range you want to count.

In our example, we’ll be counting values in the range A2:A27.

### Step 3

Next, we’ll add a second parameter in our COUNTIF function. This parameter will be the criteria used to determine whether the cell is included in the count.

In our example, we’ve discovered that there are 3 instances of orders for “XS” size shirts.

We then used the AutoFill tool to find the counts for every other shirt size.

### Step 4

The COUNTIF function also works with numerical-based criteria.

### Step 6

We can use the criteria “<>” to count all non-empty cells in a range.

Similarly, we can use the empty string “” as an argument to count all blank cells in a given range.

## Summary

This guide should be everything you need to use the COUNTIF function in Google Sheets.

You may make a copy of this example spreadsheet to test it out on your own.