How to use Excel COUNTIF Function

Excel COUNTIF Function counts the number of cells which meet a given criterion.

In simple words, you can specify a value and count the number of cells which have that value from a given range of cells.

Syntax

COUNTIF(range, criteria)

  1. range A range of cells from which you want to count the cells which meet criteria.
  2. criteria A criteria to check to count cells.


More Information

Examples

1. Using Logical Operators as a Criteria: In the below example, we have used ">75" (a logical operator) to count the number of students who scored more than 75.

use operators with excel countif function

If you want to use a logical operator you have to put it inside the double quotation marks.

2. Using Dates as a Criteria: In the below example, we have used a date in criteria to find out how many employees have a week off on 4th July.

use date text criteria in excel countif function

We have inserted a date directly into the function as COUNTIF automatically converts a text into a date.

use date number crieria in excel countif function

In the above example, we have inserted same date as a number and as you know Excel stores a date as a number. So you can also insert a number which represents a date as per Excel's date system.