HomeGoogle DocsSpreadsheetAverage IF: Find Average Based on Condition in Google Sheets

Average IF: Find Average Based on Condition in Google Sheets

Published on

Find the average of a row or column when given condition in same or another corresponding row or column matches. To find average based on a condition in Google Sheets, there is no need to combine IF and Average functions. You can straight away use the AVERAGEIF function in Google Sheets.

How to Use Averageif Function In Google Sheets

Syntax and Explanation:

AVERAGEIF(criteria_range, criterion, [average_range])

criteria_range – The range to check against a condition/criterion.

criterion – The pattern/condition/test to apply to criteria_range.

Usage:

=AVERAGEIF(A2:A9,"Male",B2:B9)

This formula will return the average age of the gender “Male”. In this example, you can say that the gender is in Column A (A2: A9) and it’s called the criteria_range. The text “Male” in the formula is the criterion.

Below you can learn how to use the number, date, comparison operators as criteria in Google Sheets Averageif function.

Find Average Based on Condition in Google Sheets

Here are a few examples.

Number as the criterion in Google Sheets Averageif Function.

I have used the below Averageif formula to find the average marks scored by the students from Class 5.

Number as criterion in Google Sheets Averageif Function.

After seeing this formula, I know some of you may think that there is a typo in this formula.

As I’ve told you, a number is our criterion here. So normally when we use a number as the criterion, it should not be enclosed in double quotes! But I used double quotes here. Why?

I’ll explain it. But here also you can use the formula as below and it’s the proper use.

=AVERAGEIF(B2:B11,5,C2:C11)

See there are no double quotes with criterion in this example. But even if you put double quotes, Google Sheets AVERAGEIF would treat it as a number!

For example, you can put the criterion as 5 or “5” and both are numbers. When you want to use the comparison operators greater than or less than with number criterion, then you should use the number within double quotes as “>5”. I just want to make you understand this with the above usage.

Date criterion in Google Sheets Averageif Function

Honestly, the date criteria always put me in a mess. That’s why I’m giving extra attention to date criteria in my tutorials. Here are a few examples.

1. Usage of Date Criteria in Google Sheets Filter function.

2. How to Use Date as Criteria in Query in Google Sheets.

3. Usage of Date Criteria in Google Sheets Sumproduct Function.

Note: There are more such tutorials on this site that you can search and find.

Now let me explain how to use Date Criteria in Averageif in Google Sheets.

how to use Date Criteria in Averageif

Here I just want to find the average quantity sold on today’s date. So I’ve used the Date Function TODAY as the criterion in Averageif formula.

If you want to directly use the date, it will be as follows.

=AVERAGEIF(A2:A11,DATE(2018,3,19),B2:B11)

Find The Average, If the Cells Are Not Blank

Finding the average of nonblank cells are a little tricky. You can use the comparison operator <> here which is equal to the logical NOT. Here is that use.

Find Average If Cells Are Not Blank

I think the above examples are enough to learn how to find average based on the condition in Google Sheets. That’s all. Thanks for the stay!

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Converting a Range to a Table and Vice Versa in Google Sheets

Google Sheets has recently introduced several features, with one of the latest being the...

EXPAND + Stacking: Expand an Array in Excel

We can expand an array by adding values at the end using the EXPAND...

Convert Month Name to Days in Google Sheets

We can utilize the EOMONTH, MONTH, DATE, and DAY functions in Google Sheets to...

Creating Custom Descending Sequence Lists in Excel

You can utilize functions like ROW or SEQUENCE in Excel to create a custom...

More like this

Converting a Range to a Table and Vice Versa in Google Sheets

Google Sheets has recently introduced several features, with one of the latest being the...

Convert Month Name to Days in Google Sheets

We can utilize the EOMONTH, MONTH, DATE, and DAY functions in Google Sheets to...

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

6 COMMENTS

    • Hi, Stephen Doyle,

      I’m in the dark 🙁

      If you want to find the average of the numbers in the above cells excluding zeros, then try this.

      =AVERAGEIF({D2,F2,H2,J2,L2,N2,P2,R2},"<>0")

      Looking for something else? Please explain.

  1. Please provide the formula if time function is used and if criteria are more than one and the criteria values of the range are time values.

    e.g.

    AVERAGEIF(B670:B780,{"NKCR","OKSR","SGRL","KRSL","MDMD","JRGR","BRRB","GPCK","SCDG"},H670:H780)

    I tried using arrayformula like below:

    Arrayformula(AVERAGEIF(B670:B780,{"NKCR","OKSR","SGRL","KRSL","MDMD","JRGR","BRRB","GPCK","SCDG"},H670:H780)

    but this returned an average of only the first criteria “NKCR”.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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