# How to Use the CountIf Function in Excel

In this tutorial, you will learn how to use the COUNTIF function in Excel.

To count the number of cells that match a requirement, such as the number of times a specific city occurs in a client list, use COUNTIF, one of the statistical functions.

Once ready, we’ll get started by utilizing real-world examples to show you how to use the COUNTIF function in Excel.

## Use the COUNTIF function in Excel

Before we begin we will need a group of data to be used to use the COUNTIF function in Excel.

### Step 1

First, you need to have a clean and tidy group of data to work with.

### Step 2

In this example, we want to know the number of students attending our class. To do so, we can simply use the COUNTIF function in a formula like this =COUNTIF(B2:B6,”YES”).

### Step 3

Once you press Enter, your formula will return the number of students attending class.

### Summary

That’s all there is to it. You are welcome to copy the example spreadsheet below to see how it is done. The most crucial lesson is to enjoy yourself while doing it.

In this tutorial, I covered how to use the COUNTIF function in Excel.