The method for this task depends on the result you want to see.
Count the occurrence of a value in a range of cells
Use the COUNTIF function to do this task.
ExampleThe example may be easier to understand if you copy to a blank worksheet.
How?
- Create a blank workbook or worksheet.
- Select the example in the Help topic. Do not select the row or column headers.
![]()
Selecting an example from Help
- Press CTRL+C.
- In the worksheet, select cell A1, and press CTRL+V.
- To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
|
|
Count the occurrence of more than one condition
Use the IF and SUM functions to do this task.
ExampleThe example may be easier to understand if you copy it to a blank worksheet.
How?
- Create a blank workbook or worksheet.
- Select the example in the Help topic. Do not select the row or column headers.
![]()
Selecting an example from Help
- Press CTRL+C.
- In the worksheet, select cell A1, and press CTRL+V.
- To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
|
|
Note The formulas in this example must be entered as array formulas. Select each cell that contains a formula, press F2, and then press CTRL+SHIFT+ENTER.
Count the occurrences of unique entries
Note If your list contains numbers, the PivotTable report totals the entries instead of counting them. To change from the Sum summary function to the Count summary function, on the PivotTable toolbar, click Field Settings , and then in the Summarize by box, click Count.
Count the number of unique values
For example, if a column contains 1,2,2,2 the result is 2 unique values in the column.