Excel COUNTIF Function Syntax

In Excel, a function’s syntax refers to the layout of the function and includes the function’s name, brackets, and arguments. The syntax for the COUNTIF function is: The function’s arguments tell the function what condition is being tested for and what range of data to count when the condition is met.

Range: The group of cells the function is to search. Criteria: The value compared with the data in the Range cells. If a match is found, the cell in the Range is counted. Actual data or the cell reference to the data can be entered for this argument.

Enter the Example Data

Follow the steps in this article to create and use the COUNTIF function. In this example, the COUNTIF function counts the number of sales representatives with more than 250 orders. The first step to using the COUNTIF function in Excel is to enter the data. Enter the data into cells C1 to E11 of an Excel worksheet as shown in the image above. The COUNTIF function and the search criteria (greater than 250 orders) will be added to row 12 below the data.

Build the COUNTIF Function

Although it is possible to type the COUNTIF function into a cell in a worksheet, it’s easier to use the built-in COUNTIF function in Excel to enter the function. The data entered into the two blank rows in the dialog box form the arguments of the COUNTIF function. These arguments tell the function what condition is being tested for and what cells to count when the condition is met.

Highlight the Range Argument

The Range argument tells the COUNTIF function which group of cells to search when trying to find the specified criteria.

Specify the Criteria Argument

The Criteria argument tells COUNTIF what data it should find in the Range argument. Although actual data (such as text or numbers like >250) can be entered for this argument, it is best to enter a cell reference into the dialog box (such as D12) and enter the data you want to match into that cell in the worksheet. An answer of zero appears in cell E12 (the cell where the function was entered) because data has not been added to the Criteria field (cell D12).

Add the Search Criteria

The last step in the tutorial is to add the criteria the function will match. In this case, the number of Sales Reps with more than 250 orders for the year will be counted.