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.
Our workbook contains data from restaurant orders, which include the item ordered by the customer and the amount paid. In the example shown, cell C3 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.
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.
My name is Radu Meghes, and I'm the owner of excelexplained.com. Over the past 15+ years, I have been using Microsoft Excel in my day-to-day job. I’ve worked as an investment and business analyst, and Excel has always been my most powerful weapon. Its flexibility and complexity make it a highly demanded skill for finance employees. I launched excelexplained.com back in 2017, and it has become a trusted source for Excel tutorials for hundreds of thousands of people each year.
If you'd like to get in touch, you can contact me on LinkedIn.
Thousands of people have benefited from my free Excel lessons. My only question is, will you be next?
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.