Please use COUNTIF function to this task. Below is the complete details of COUNTIF:
Syntax:
COUNTIF(Range, Criterion)
Description:
Counts those cells in a cell range that fulfill the specified criterion.
Range is the cell range to be evaluated.
Criterion is the condition that the values in Range have to fulfill to be included:
Use numbers or text (like "42" or "bolts") to count all cells that contain that value.
Tip: To count all non-empty cells, use "*" as criterion. For example COUNTIF(D2:D4, "*") counts all cells in the specified area that are not empty.
Use conditions (like ">10" or "<=5") to count all cells that match the specified condition.
Note: Criteria always have to be surrounded by double quotation marks (").
Example:
If the cells A1:A5 contain the values 1, 2, 3, 2, 1: The following applies:
COUNTIF(A1:A5, "2") returns 2
COUNTIF(A1:A5, ">=2") returns 3
Please check this sample file also for better understanding.