Using COUNTIF and SUMIF: Conditional Counting and Summation Made Easy
Share
Excel has dozens of functions for working with data, but two of the most useful for quick analysis are COUNTIF and SUMIF. They let you count or add values based on a condition, which makes them handy for spotting trends or pulling out key numbers. This article walks through how they work with simple examples.
Understanding COUNTIF
The COUNTIF function enables users to count the number of cells in a range that meet a specific condition. This function is particularly useful when analyzing datasets with categorical information.
Syntax of COUNTIF
The syntax for the COUNTIF function is as follows:
=COUNTIF(range, criteria)
- range: This is the range of cells that you want to evaluate.
- criteria: This defines the condition that determines whether a cell is counted. The criteria can be a number, text, expression, or a cell reference.
Example of COUNTIF
Consider a dataset containing sales data for different products:

Suppose we want to count how many times "Apples" appear in the dataset. The COUNTIF function can be applied as follows:
=COUNTIF(B4:B8, "Apples")
In this case, the function will return 2, as "Apples" appears twice in the specified range.
![]()
Understanding SUMIF
The SUMIF function complements COUNTIF by summing values in a specified range based on a defined condition. This function is particularly useful for aggregating data based on categorical criteria.
Syntax of SUMIF
The syntax for the SUMIF function is structured as follows:
=SUMIF(range, criteria, [sum_range])
- range: This is the range of cells that you want to evaluate for the criteria.
- criteria: This specifies the condition that must be met for a cell to be included in the summation.
- sum_range: This is the range of cells to sum. If omitted, Excel sums the cells in the range parameter.
Example of SUMIF
Using the same dataset as before, let’s calculate the total sales for "Bananas." The SUMIF function would be utilized as follows:
=SUMIF(B4:B8, "Bananas", D4:D8)
This formula evaluates the range B4:B8 for the criteria "Bananas" and sums the corresponding values in the range D4:D8. The result will be 450, as the sales for Bananas are 200 and 250.
![]()
Practical Application
Conditional Counting with COUNTIF
Consider a scenario where a business wants to assess product popularity based on sales data. By using COUNTIF, the business can quickly understand how many products sold over a certain threshold. For example, if you want to count how many products had sales greater than 150, you could use:
=COUNTIF(D4:D8, ">150")
This formula will result in a count of 3, indicating three products had sales greater than 150.
![]()
Conclusion
The COUNTIF and SUMIF functions make it easy to count or add values that meet specific conditions. They’re simple to learn and useful in many contexts, from tracking product sales to pulling totals in financial reports. Knowing how to use them well helps you turn raw tables into insights you can act on.