The function COUNTIF can be used to count the number of cells that are equal to a specific value. The figure below explains how to use the COUNTIF function to count the number of cells that fit a certain criteria.

**Formula**

The general syntax of the COUNTIF function is as follows:

**=COUNTIF (range, value)**

**Range**is the group of cells that you want to test against your value criteria.**Value**contains the value to count in**range**argument

**Explanation**

According to figure 1, the cell G7 contains the formula:

**=COUNTIF(D6:D12,“Blue”)**

The Excel COUNTIF function counts the number of cells that match the supplied criteria. For this example, we are using the range of **D6:D12** and counting the number of cells which contain the string “**B****lue**”.

COUNTIF will return the count of all the values equal to “Blue”. One major thing to be noted here is that when any text value is applied, it needs to be enclosed in double quotes (“”).

**Example**

In this example, color names are given in cell range **D6:D12** and you need to count the cells which contain “**Blue**” using the COUNTIF function.

*Figure 1: COUNTIF Function*

## Leave a Comment