Count cells equal to a specific value

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

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 B7:B17 (named 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.

What to do next?

I strongly recommend writing more formulas. You can do so by checking out my article on how to count cells between two dates using COUNTIFS.

If you have additional questions please let me know by posting a comment.

Add comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Excel courses

I have compiled a list of the best Excel online courses. It covers basic and advanced topics, VBA, and Power BI.

View courses