Formualizer Docs

AVERAGEIF

Returns the average of cells that satisfy a single criterion.

AVERAGEIF tests each cell in range, then averages matching values from average_range (or from range when average_range is omitted).

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=AVERAGEIF(range, criteria, [average_range])

Arguments

ArgumentTypeRequiredDefault
rangeanyRequired—
criteriaanyRequired—
average_rangeanyOptional—

Differences from Excel

Excel requires a reference for the optional result range, where Formualizer can evaluate a non-reference expression and propagate its error. Formualizer also accepts array constants as the criteria range, which Excel requires to be a reference.

Remarks

  • An equality criterion for a date or number ("10/26/1999", "36459", 36459) also matches text cells holding that date; <> and ordering criteria do not read date text.
  • Criteria support comparison operators and wildcard text patterns.
  • Non-numeric values in the averaged cells are ignored.

Error cases

  • If no cells match, AVERAGEIF returns #DIV/0!.

Examples

Select East records by label and aggregate the corresponding numbers.

Formula =AVERAGEIF(A1:A3,"East",B1:B3)

Input cells
AB
1"East"10
2"West"50
3"East"20

Expected result 15

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Omit the result range so the criterion and calculation use the same cells.

Formula =AVERAGEIF(C1:C3,">2")

Input cells
C
12
24
36

Expected result 5

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Aggregate a single row that satisfies the criterion.

Formula =AVERAGEIF(A1:A1,"East",B1:B1)

Input cells
AB
1"East"10

Expected result 10

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Average values greater than a threshold

Formula =AVERAGEIF(A1:A3, ">20")

Input cells
A
110
225
340

Expected result 32.5

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Average one range using criteria from another

Formula =AVERAGEIF(A1:A3, "East", B1:B3)

Input cells
AB
1"East"10
2"West"40
3"East"20

Expected result 15

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

When does AVERAGEIF return #DIV/0!?

It returns #DIV/0! when no matching cells contribute numeric values.

If average_range is omitted, what gets averaged?

The function averages matching numeric cells from the criteria range itself.

Implementation

Engine source

On this page