Related Tutorial: Step by Step Tutorial with Screen Shots -Excel COUNTIF Function
The syntax for the COUNTIF function is:
=COUNTIF ( Range, Criteria)
Range - the group of cells the function is to search.
Example: Using Excel's COUNTIF Function
In this example we will count up the number of cells in our data range that contain the number 165.
For help with this example, see the image above.
- Enter the following data into cells E1 to E6: 114, 165, 178, 143, 130, 165.
- Click on cell E7 - the location where the results will be displayed.
- Click on the Formulas tab.
- Choose More Functions > Statistical from the ribbon to open the function drop down list.
- Click on COUNTIF in the list to bring up the function's dialog box.
- In the dialog box, click on the button at the end of the Range line to return to your spreadsheet.
- Drag select cells E1 to E6 on the spreadsheet to highlight them.
- Click on the button at the end of the Range line to return to the dialog box.
- On the Criteria line in the dialog box, type "165" since we are looking for the number of cells containing this number.
- Click OK.
- The answer 2 should appear in cell E7 since two cells in the range - A2 and A6 - contain the number 165 and, therefore, match the criteria argument.
- When you click on cell E7 the complete function
= COUNTIF (E1 : E6 , 165 ) appears in the formula bar above the worksheet.