The syntax for the COUNTIF function is:
=COUNTIF ( Range, Criteria )
Range - the group of cells the function is to search.
Example Using the Google Spreadsheet COUNTIF Function:
For help with this example, see the image above.
- Enter the following data into cells A1 to A6: 114, 165, 178, 143, 130, 165.
- Click on cell A7 - the location for the function and where the results will be displayed.
- Click on Insert > Formula > More Formulas in the menus to bring up the Insert a formula dialog box.
- Click on Math in the left hand side of the dialog box to show the list available functions.
- Scroll down in the list of available math functions on the right hand side of the dialog box until you find COUNTIF in the list.
- Double click on the function name to enter the function into cell A7 in the spreadsheet.
- Close the function dialog box by clicking on the close button in the top right corner of the dialog box.
- Double click on the word range in the function in cell A7 to highlight it.
- Drag select cells A1 to A6 on the spreadsheet to enter those cells as the function's range.
- Double click on Criteria in the function in cell A7 to highlight it.
- Type "165" to enter that value as the function's criteria argument.
- Press the ENTER key on the keyboard to complete the function.
- The answer 2 should appear in cell A7 since two cells - A2 and A6 - in the range contain the number 165 and, therefore, match the criteria argument.
- When you click on cell A7 the complete function = COUNTIF (A1 : A6 , 165 ) appears in the formula bar above the worksheet.