Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets AVERAGEIF Function: Step-by-Step Guide

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

AVERAGEIF in Google Sheets calculates the average of numbers in a range that meet a single condition. For example, you can average all sales amounts where the region is "North" or all scores above 80. To use it, type =AVERAGEIF(range, criterion, average_range) in a cell, replacing the arguments with your actual ranges and condition. This guide walks you through the syntax, gives practical examples, and covers common pitfalls.

What You'll Need

  • A Google account with access to Google Sheets (free with any Google account).
  • A spreadsheet with data organized in columns or rows. For example, one column of categories and another column of numbers to average.
  • Basic familiarity with entering formulas (starting with =).

Step-by-Step

  1. Open your spreadsheet in Google Sheets and identify the data you want to analyze. For instance, column A contains product names, and column B contains sales amounts.
  2. Click an empty cell where you want the result to appear.
  3. Type the AVERAGEIF formula starting with an equals sign: =AVERAGEIF(. Google Sheets will show a tooltip with argument names.
  4. Enter the range that contains the criteria. This is the column or row you want to test. For example, if product names are in A2:A100, type A2:A100.
  5. Type a comma to move to the next argument.
  6. Enter the criterion — the condition that must be met. This can be a number, text, or expression. For text, enclose it in double quotes, e.g., "Widget". For numbers, you can use 100 or a comparison like ">100". For a cell reference, use the cell address without quotes, e.g., D1.
  7. Type another comma and enter the average_range — the cells to average if the condition is met. If omitted, AVERAGEIF averages the cells in the first range. For example, if sales amounts are in B2:B100, type B2:B100.
  8. Close the parenthesis and press Enter. The cell will display the average of the numbers in average_range that correspond to rows where the range meets the criterion.
  9. Verify the result by manually checking a few rows or using a filter to confirm the average makes sense.
  10. Copy the formula down or across if you need to apply it to other criteria. Use absolute references (e.g., $A$2:$A$100) if you want the ranges to stay fixed.

That's the basic flow. Now let's look at a concrete example to make it stick.

Suppose you have a table with regions in column A (A2:A10) and sales in column B (B2:B10). To average sales for the "North" region, use: =AVERAGEIF(A2:A10, "North", B2:B10). If you want to average sales greater than 500, use: =AVERAGEIF(B2:B10, ">500"). Note that when averaging the same range you're testing, you can omit the third argument.

Common Mistakes

  • Forgetting quotes around text criteria. AVERAGEIF requires text criteria in double quotes, e.g., "North", not North. Without quotes, Sheets may interpret it as a named range or return an error.
  • Mismatched range sizes. The range and average_range must be the same size and shape. If range is A2:A10 (9 cells), average_range must also be 9 cells (e.g., B2:B10). Otherwise, you'll get a #VALUE! error.
  • Using the wrong comparison operator. For "greater than", use ">100" (with quotes). Writing >100 without quotes will cause a parse error.
  • Including the header row. If your range includes headers, the criterion might match the header text and skew results. Use ranges that start after the header, like A2:A100.
  • Assuming AVERAGEIF works like SUMIF for wildcards. AVERAGEIF supports wildcards (* and ?) in text criteria, but they must be inside quotes, e.g., "Nor*".
  • Ignoring hidden rows. AVERAGEIF includes hidden rows in its calculation. If you need to exclude them, use AVERAGEIFS with additional criteria or filter the data first.

Tips

  • Use cell references for criteria to make your formula dynamic. For example, =AVERAGEIF(A2:A10, D1, B2:B10) where D1 contains the criterion. This lets you change the condition without editing the formula.
  • Combine with other functions like IFERROR to handle cases where no cells meet the criterion: =IFERROR(AVERAGEIF(...), "No matches").
  • For multiple criteria, use AVERAGEIFS instead. AVERAGEIF only handles one condition.
  • Format the result as a number or currency to match your data.
  • Test with a small dataset first to ensure your formula works as expected before applying to large ranges.

Troubleshooting

If your AVERAGEIF formula returns an error or unexpected result, check these common issues:

  • #DIV/0! error: This means no cells met the criterion, so there's nothing to average. Verify your criterion matches the data (e.g., check for extra spaces or typos). Use IFERROR to display a friendly message.
  • #VALUE! error: Often caused by mismatched range sizes or non-numeric data in the average_range. Ensure both ranges are the same size and that average_range contains only numbers.
  • #NAME? error: Usually indicates a misspelled function name or unquoted text. Check that you typed AVERAGEIF correctly and that text criteria are in quotes.
  • Wrong average: Double-check that your ranges are correct and that you haven't included header rows or blank cells that might affect the result. Also, remember that AVERAGEIF ignores blank cells and text in the average_range.
  • Formula not updating: If you change the data and the result doesn't update, ensure that automatic calculation is on (File > Settings > Calculation).

If you've checked all these and still have trouble, try simplifying the formula or breaking it down into smaller parts to isolate the issue.

Frequently Asked Questions

Can AVERAGEIF handle multiple criteria?

No, AVERAGEIF only supports one criterion. For multiple criteria, use AVERAGEIFS, which allows you to specify additional ranges and criteria.

What happens if the average_range is omitted?

If you omit the average_range, AVERAGEIF averages the cells in the first range (the range being tested). This is useful when you want to average the same values you're testing against.

Does AVERAGEIF work with dates?

Yes, you can use dates as criteria. For example, =AVERAGEIF(A2:A10, ">2023-01-01", B2:B10) averages values where the date is after January 1, 2023. Ensure dates are in a recognized format.

Can I use wildcards in AVERAGEIF?

Yes, wildcards like * (any number of characters) and ? (one character) work in text criteria when enclosed in quotes. For example, "North*" matches "North", "Northeast", etc.

Why does my AVERAGEIF return 0?

Returning 0 usually means the average of matching cells is actually 0, or no cells matched and the average_range contains zeros. Check your criterion and data. If no matches, you'll get #DIV/0! unless you handle it with IFERROR.

Is AVERAGEIF case-sensitive?

No, AVERAGEIF is not case-sensitive. "north" and "North" are treated the same. For case-sensitive averaging, you'd need a more complex formula using SUMPRODUCT or a helper column.