The COUNTIF function in Excel allows you to count the number of cells that meet a specific criterion. Here are some examples:
-
To count the number of cells containing the word “apples” in the range A2:A5, use:
=COUNTIF(A2:A5, "apples")
This will return 2.
-
To count cells with a value greater than 55 in the range B2:B5, use:
=COUNTIF(B2:B5, ">55")
The result is 2.
-
For more complex criteria, you can combine COUNTIF with operators. For instance, to count cells in column B that contain values less than 50:
=COUNTIF(B:B, "<50")
Remember that COUNTIF ignores upper and lower case in text strings, making criteria case-insensitive.