Use the COUNTIF function to count cells if equal to specified criterion,e.g. count all cells if contain ‘green’. In our example, we will count those cells which contain/ equal to ‘Blue’.
How the formula works
The formula used has following arguments:
range (A5:A9) – The range of cells to count based on the criteria.
criteria (“blue”) – The criteria to determine which cells to count, .e.g. count if equal to “blue”.