Average If Excel Multiple Criteria: Step-by-Step Guide
In this article
To average numbers in Excel based on more than one condition, use the AVERAGEIFS function. Its syntax is =AVERAGEIFS(average_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...). For example, to average sales in the East region for product A, you would write =AVERAGEIFS(C2:C100, A2:A100, "East", B2:B100, "A"). This guide walks you through setting it up correctly, avoiding common pitfalls, and troubleshooting when the result looks wrong.
What You'll Need
- Microsoft Excel (any recent version for Windows, Mac, or Excel for the web). AVERAGEIFS is available in Excel 2007 and later.
- A dataset with at least one numeric column to average and one or more columns containing the criteria you want to filter on.
- Basic familiarity with cell references and ranges (e.g., A2:A100).
Step-by-Step
- Identify your ranges. Decide which column contains the numbers you want to average (the average_range) and which columns contain the conditions (the criteria_ranges). For example, column C might hold sales amounts, column A the region, and column B the product.
- Click the cell where you want the result. This is where the formula will live. It can be on the same sheet or a different one.
- Type
=AVERAGEIFS(. Excel will show a tooltip with the argument order. You can also find AVERAGEIFS under Formulas > More Functions > Statistical, but typing is faster and less error-prone. - Enter the average_range first. Select the column of numbers you want to average, e.g.,
C2:C100. Do not include the header row. Press comma. - Enter the first criteria_range and its criteria. For example,
A2:A100, "East". The criteria_range must be the same size as the average_range. Press comma. - Enter the second criteria_range and criteria. For example,
B2:B100, "A". You can add up to 127 pairs of criteria ranges and criteria. - Close the parenthesis and press Enter. The formula should look like
=AVERAGEIFS(C2:C100, A2:A100, "East", B2:B100, "A"). Excel returns the average of all values in C2:C100 where column A equals "East" and column B equals "A". - Use cell references for criteria if you want flexibility. Instead of hardcoding "East", you can put "East" in a cell (say E1) and use
E1as the criteria. This makes it easy to change the filter without editing the formula. - Copy the formula down or across if needed. If you want to calculate averages for multiple combinations, set up a small table with the criteria values and copy the formula, using relative and absolute references appropriately (e.g., lock ranges with $).
- Verify the result. Manually filter the data for the same conditions and use the status bar average, or use a pivot table, to cross-check. If the numbers match, you are done.
Common Mistakes
- Mismatched range sizes. The average_range and every criteria_range must have the same number of rows and columns. If one is C2:C100 and another is A2:A99, Excel returns a #VALUE! error.
- Including headers in ranges. Headers are text, so they will not match numeric criteria and can skew results if the average_range includes a text header (AVERAGEIFS ignores text, but it is still best to exclude headers).
- Forgetting quotes around text criteria. Criteria like "East" must be in double quotes unless you reference a cell. Numbers can be unquoted, but text and wildcards need quotes.
- Using the wrong comparison operator. For "greater than 100", write ">100" as a single string, not ">" & 100 unless you are concatenating a cell reference.
- Assuming AVERAGEIFS works like AVERAGEIF. AVERAGEIF takes the criteria_range first, then criteria, then average_range. AVERAGEIFS takes average_range first. Mixing them up gives wrong results or errors.
- Ignoring hidden rows or filtered data. AVERAGEIFS includes all rows that meet the criteria, even if they are hidden by a filter. If you need to average only visible rows, use AGGREGATE or a helper column.
Tips
- Use wildcards in text criteria:
"East*"matches any text starting with East;"?"matches any single character;"*"matches any sequence. To find a literal question mark or asterisk, precede it with a tilde (~). - For dates, use criteria like ">="&DATE(2024,1,1) or reference a cell containing the date. Remember that Excel stores dates as serial numbers, so comparison operators work as expected.
- To average with OR logic across multiple criteria on the same range, you cannot use AVERAGEIFS directly (it uses AND logic). Instead, use an array formula with AVERAGE and IF, or sum multiple AVERAGEIFS results weighted by counts. For example, to average values where region is East OR West, use
=AVERAGE(IF((A2:A100="East")+(A2:A100="West"),C2:C100))entered with Ctrl+Shift+Enter in older Excel, or use AVERAGE with FILTER in Excel 365. - Name your ranges (Formulas > Define Name) to make formulas easier to read and maintain.
- If you need to average based on multiple criteria and also ignore errors in the average_range, wrap the average_range in IFERROR inside an array formula, or clean the data first. AVERAGEIFS itself does not ignore errors; it returns an error if any cell in the average_range contains an error and meets the criteria.
- Use a pivot table for quick multi-criteria averages without formulas: drag fields to Rows and Columns, then set Values to Average. This is often faster for exploration.
Troubleshooting
If your AVERAGEIFS formula returns an error or an unexpected result, work through these checks in order:
- #DIV/0! error: No cells meet all criteria. Check that your criteria ranges actually contain matching values. Text comparisons are not case-sensitive, but extra spaces can cause mismatches. Use TRIM or check for non-printing characters.
- #VALUE! error: Range sizes are inconsistent, or a criteria argument is malformed (e.g., missing quotes around text). Verify that every range has the same dimensions.
- Result is 0 or blank: The average_range might contain text or empty cells that are being ignored, or the criteria might be matching only cells with zero. Check the underlying data.
- Wrong average: Confirm you have the argument order correct: average_range first, then pairs of criteria_range and criteria. Also check that you are not accidentally including the header row in any range.
- Formula not updating: Ensure calculation is set to Automatic (Formulas > Calculation Options > Automatic). If you copied the formula, check relative references.
- Criteria with wildcards not working: Wildcards work in AVERAGEIFS for text, but not for numbers. Also, if you are using a cell reference for criteria that contains a wildcard, it works as expected.
If none of these solve the issue, try rebuilding the formula step by step: start with one criteria pair, confirm it works, then add the second. Use the Evaluate Formula tool (Formulas > Evaluate Formula) to see how Excel calculates each part.
Frequently Asked Questions
Can I use AVERAGEIFS with more than two criteria?
Yes. AVERAGEIFS supports up to 127 pairs of criteria_range and criteria. Just keep adding them separated by commas.
What is the difference between AVERAGEIF and AVERAGEIFS?
AVERAGEIF handles a single condition and its argument order is criteria_range, criteria, average_range. AVERAGEIFS handles multiple conditions and starts with average_range, then criteria_range1, criteria1, and so on.
Does AVERAGEIFS work with dates?
Yes. Use date criteria as strings with operators, e.g., ">="&DATE(2024,1,1), or reference a cell containing a date. Ensure the criteria_range contains real dates, not text that looks like dates.
Can I average only visible rows with AVERAGEIFS?
No. AVERAGEIFS includes hidden rows. To average only visible rows that meet criteria, use AGGREGATE with a function number that ignores hidden rows, or add a helper column that flags visibility and include that as an additional criterion.
Why does my AVERAGEIFS return #DIV/0! when I can see matching data?
Likely a mismatch in range sizes, or the criteria are not matching due to extra spaces, different data types (text vs. number), or case differences in wildcard patterns. Check each criteria range for consistency.
Can I use cell references for the criteria?
Yes. For example, if E1 contains "East", use E1 as the criteria argument. For operators, concatenate: ">"&E1 for greater than the value in E1.