AVERAGEIF function

Returns the average of cells matching a single criterion, useful for conditional averages like mean cost by warehouse or mean inventory per SKU.

=AVERAGEIF(range, criteria, [average_range])

Generate a AVERAGEIF formula

Describe what you need. The generator will reach for AVERAGEIF where AVERAGEIF is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How AVERAGEIF reads its arguments
rangerequiredcriteriarequiredaverage_rangeoptionalAVERAGEIF
ArgumentRequiredDescription
rangeRequiredThe range of cells to evaluate against the criterion; can include numbers, text, dates, or references to be checked for matches.
criteriaRequiredThe condition to match, such as '>100' for numeric comparisons or 'North' for text; text criteria are case-insensitive.
average_rangeOptionalOptional; the cells to average (if omitted, range is averaged instead); must align dimensionally with range.

Returns

A number representing the average of cells in average_range that match the criterion.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Average cost of items stored in the North warehouse

SKUWarehouseOn HandReorder PointCost
SKU-001North15010025.5
SKU-002North805015
SKU-001South20010025.5
SKU-002South455015
SKU-003North1207532
SKU-003South957532
=AVERAGEIF(B2:B7,"North",E2:E7)

Result: 24.17

The formula scans the Warehouse column (B2:B7) for 'North' and finds rows 2, 3, and 6. It then averages the corresponding costs: (25.50 + 15.00 + 32.00) / 3 = 24.17. Use this to compare average costs across warehouse locations.

2. Average on-hand inventory for SKU-001 across all warehouses

SKUWarehouseOn HandReorder PointCost
SKU-001North15010025.5
SKU-002North805015
SKU-001South20010025.5
SKU-002South455015
SKU-003North1207532
SKU-003South957532
=AVERAGEIF(A2:A7,"SKU-001",C2:C7)

Result: 175

The formula finds all rows where column A equals 'SKU-001' (rows 2 and 4) and averages their on-hand quantities: (150 + 200) / 2 = 175. This reveals average stock levels per SKU across your warehouse network.

3. Average reorder point for items costing more than 20

SKUWarehouseOn HandReorder PointCost
SKU-001North15010025.5
SKU-002North805015
SKU-001South20010025.5
SKU-002South455015
SKU-003North1207532
SKU-003South957532
=AVERAGEIF(E2:E7,">20",D2:D7)

Result: 91.67

The formula evaluates costs in column E for values greater than 20, matching rows 2, 4, and 6 (costs 25.50, 25.50, 32.00). It then averages their reorder points: (100 + 100 + 75) / 3 = 91.67. This identifies threshold levels for higher-value inventory.

Common errors

Which AVERAGEIF error are you seeing?
AVERAGEIF returned an error#DIV/0!
Verify your criteria correctly identifies at least one cell (check spelling, spacing, and case for text; verify numeric ranges contain matching values). Use =COUNTIF(range, criteria) to confirm matches exist.
#VALUE!
Ensure criteria is well-formed: numeric comparisons like '>100' or '<=50', text like '"North"', or wildcards like '"SKU-*"'. Every operator must have an operand.
#REF!
Verify that all referenced ranges exist and use valid syntax (e.g., A2:A10, not A2:10). If you deleted rows or columns, update the formula accordingly. Use absolute references ($A$1:$A$10) to prevent breakage if rows are inserted.
ErrorWhy it happensHow to fix it
#DIV/0!No cells in the range match the criteria, leaving nothing to average. AVERAGEIF cannot compute an average with zero matches.Verify your criteria correctly identifies at least one cell (check spelling, spacing, and case for text; verify numeric ranges contain matching values). Use =COUNTIF(range, criteria) to confirm matches exist.
#VALUE!The criteria argument contains invalid syntax, such as an incomplete operator (e.g., '>' without a value) or mismatched or malformed quotes.Ensure criteria is well-formed: numeric comparisons like '>100' or '<=50', text like '"North"', or wildcards like '"SKU-*"'. Every operator must have an operand.
#REF!The range or average_range references cells, columns, or rows that no longer exist, or uses invalid range syntax.Verify that all referenced ranges exist and use valid syntax (e.g., A2:A10, not A2:10). If you deleted rows or columns, update the formula accordingly. Use absolute references ($A$1:$A$10) to prevent breakage if rows are inserted.

Tips and when to use something else

  • For multiple criteria, use AVERAGEIFS instead—e.g., =AVERAGEIFS(E:E, B:B, 'North', E:E, '>20') averages costs where warehouse is 'North' AND cost exceeds 20.
  • AVERAGEIF ignores empty cells and text values in average_range; they do not count toward the average denominator.
  • Use wildcards in text criteria: '"S*"' matches any text starting with 'S', and '"?KU"' matches any 3-letter text ending with 'KU'.
  • If average_range is omitted, AVERAGEIF averages range itself—useful when criteria and values are in the same column (e.g., average all costs above 20).

Frequently asked questions

How do I average values based on multiple conditions?
Use AVERAGEIFS, which accepts multiple criteria and range pairs. For example, =AVERAGEIFS(costs, warehouse, 'North', cost, '>20') averages costs where warehouse is 'North' AND cost exceeds 20. AVERAGEIF only supports a single criterion.
Why does my AVERAGEIF return #DIV/0!?
No cells match your criteria, so there is nothing to average. Check for spelling errors, case sensitivity (text is case-insensitive but spacing matters), and valid operators in numeric comparisons. Verify matches exist using =COUNTIF(range, criteria).
Can AVERAGEIF work with dates?
Yes. Use criteria like '>'&DATE(2025,1,1) to find dates after January 1, 2025, or use date functions in the criteria argument. Ensure dates are stored as date values, not text, for reliable results.
What is the difference between AVERAGEIF and AVERAGE?
AVERAGE calculates the mean of all values in a range unconditionally, while AVERAGEIF only averages cells matching a criterion. Use AVERAGEIF when you need conditional averaging based on values in another column.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17