Home › data analytics Tutorial › SUMIF, COUNTIF, and AVERAGEIF Functions in Excel

SUMIF, COUNTIF, and AVERAGEIF Functions in Excel

⏱ 4 min read Updated: 29 Sep 2026

SUMIF, COUNTIF, and AVERAGEIF Functions in Excel

The SUMIF, COUNTIF, and AVERAGEIF functions are useful when we want to work with specific data in Excel. They allow us to perform calculations based on a condition, such as adding sales for a particular product, counting students who scored above a certain mark, or finding the average of selected values.

In this article, we will learn about the SUMIF, COUNTIF, and AVERAGEIF functions in Excel, along with their syntax, arguments, and examples.

What Are SUMIF, COUNTIF, and AVERAGEIF Functions?

The SUMIF function adds values from a range when a specified condition is satisfied. The COUNTIF function counts the number of cells that meet a given condition. The AVERAGEIF function calculates the average of values that meet a specified condition.

We can use these functions separately to perform condition-based calculations on data in Excel.

SUMIF Function

The SUMIF function is used to add values that meet a specific condition. It is useful when we want to calculate a total based on a particular text, number, or condition.

Syntax

It has the following syntax:

=SUMIF(range, criteria, [sum_range])

Here:

  • range: It is the range of cells where Excel checks the condition.
  • criteria: It specifies the condition that must be satisfied.
  • sum_range: It is the range of cells whose values are added.

Example

Suppose we have the following data:

ProductSales
Laptop50000
Mobile30000
Laptop45000
Tablet20000

To calculate the total sales of laptops, we can use:

=SUMIF(A2:A5,"Laptop",B2:B5)

Output:

95000

The formula checks the Product column for "Laptop" and adds the corresponding values from the Sales column.

Important Points

  • SUMIF adds values based on a specified condition.
  • It can be used with text, numbers, and comparison conditions.
  • The criteria determine which cells are included in the calculation.
  • It is useful for calculating conditional totals from a dataset.

COUNTIF Function

The COUNTIF function is used to count the number of cells that meet a specific condition. It is useful when we want to know how many times a particular value or condition appears in a range.

COUNTIF Function Syntax

The syntax is given below:

=COUNTIF(range, criteria)

Here:

  • range: It is the range of cells that Excel checks.
  • criteria: It specifies the condition used for counting.

Example of COUNTIF Function

Suppose we have the following data:

NameMarks
Amit75
Rahul82
Neha90
Ravi45

To count how many students scored more than 50, we can use:

=COUNTIF(B2:B5,">50")

Output:

3

The result is 3 because three students have marks greater than 50.

Important Points

  • COUNTIF counts cells based on a specified condition.
  • It can count text, numbers, and cells that meet comparison conditions.
  • It returns the number of cells that satisfy the given criteria.
  • It is useful for analyzing and summarizing data.

AVERAGEIF Function 

The AVERAGEIF function is used to calculate the average of values that meet a specific condition. It is useful when we want to find an average for only selected data instead of the complete range.

AVERAGEIF Function Syntax

It has the following syntax:

=AVERAGEIF(range, criteria, [average_range])

Here:

  • range: It is the range where Excel checks the condition.
  • criteria: It specifies the condition that must be satisfied.
  • average_range: It is the range of values used to calculate the average.

Example of AVERAGEIF Function

Suppose we have the following data:

NameMarks
Amit75
Rahul82
Neha90
Ravi45

To calculate the average marks of students who scored more than 50, we can use:

=AVERAGEIF(B2:B5,">50")

Output:

82.33

The formula calculates the average of 75, 82, and 90, because these values are greater than 50.

Frequently Asked Questions

What is the SUMIF function in Excel?

The SUMIF function adds values that meet a specified condition.

What is the COUNTIF function in Excel?

The COUNTIF function counts the number of cells that meet a specified condition.

What is the AVERAGEIF function in Excel?

The AVERAGEIF function calculates the average of values that meet a specified condition.

Can SUMIF, COUNTIF, and AVERAGEIF be used together?

Yes, these functions can be used together to perform different condition-based calculations on the same dataset.

Conclusion

The SUMIF, COUNTIF, and AVERAGEIF functions in Excel are useful for performing condition-based calculations. The SUMIF function adds values based on a condition, COUNTIF counts cells that meet a condition, and AVERAGEIF calculates the average of values that meet a condition.

These functions are useful for Excel data analysis, reports, spreadsheets, sales data, marksheets, and large datasets.