Counting cells that equal to a specific value can be achieved really fast using COUNTIF function. If you need to use multiple criteria you can also use COUNTIFS which allows for more flexibility.
How to count cells equal to a specific value
Our workbook contains data from restaurant orders, which include the item ordered by the customer and the amount paid. In the example shown, cell C2 contains the following formula:
Using COUNTIF function is straightforward. All you need to do is define the range where you want to search for the criteria and the criteria. In our case, we want to look at the range
products) and count the number of times burgers were sold. COUNTIF returns the count of values in B7:B17 that is equal to “Burger”. Changing the criteria (cell B2) to “Pizza” will return a different result.
You can download the Excel workbook if you want to take a closer look at this example.
Note: when you want to provide the criteria directly as text, you will need to use the double quotes
"" in your formula. As an example, the above formula can also be written as
=COUNTIF(products,"Burger") and it will return the same result.
If you have additional questions please let me know by posting a comment.
In addition, you can check out my article on how to count cells between two dates using COUNTIFS.