# AVERAGEIF in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/averageif/

AVERAGEIF tests a range against one criterion and averages the matching cells. If there is no average_range, it averages the tested cells themselves.

## Syntax

```
AVERAGEIF(criteria_range, criterion, [average_range])
```

## Arguments

- `criteria_range` (range, required: yes): The cells the criterion is tested against.
- `criterion` (any, required: yes): The condition: a value, a text, or a comparison such as "<8".
- `average_range` (range, required: no): The cells to average. If omitted, criteria_range itself is averaged.

## Examples

The examples use this table, starting in A1:

| Region | Product | Units | Price |
|---|---|---|---|
| North | Pen | 10 | 2.5 |
| South | Pen | 4 | 2.5 |
| North | Book | 3 | 12 |
| East | Book | 8 | 12 |
| South | Lamp | 5 | 30 |

```
=AVERAGEIF(A2:A6, "North", C2:C6)
```

Result: `6.5`

Average units per North order: (10 + 3) / 2. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=AVERAGEIF(C2:C6, "<8")
```

Result: `4`

Without average_range, the average is taken over the tested cells: 4, 3 and 5. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=AVERAGEIF(B2:B6, "Book", D2:D6)
```

Result: `12`

Average price of Book rows. Criteria and average columns can differ. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=AVERAGEIF(A2:A6, "South", C2:C6)
```

Result: `4.5`

A result with a decimal part: (4 + 5) / 2. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=IFERROR(AVERAGEIF(A2:A6, "West", C2:C6), 0)
```

Result: `0`

No row matches West, so AVERAGEIF alone would fail. IFERROR gives 0 instead. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- When no row matches, the result is #DIV/0!, because there is nothing to average. Wrap the call in IFERROR if that can happen.
- Leaving out average_range on a text column does not average anything. AVERAGEIF(B2:B6, "Pen") returns #DIV/0! since the cells it would average are words.
- One condition only. Use AVERAGEIFS when you need two or more.

## Compared with Excel

Same syntax in Excel. Excel and Sheets both have AVERAGEIFS for several conditions.

## Related functions

- [AVERAGEIFS](https://goingstellar.ro/reference/sheets/averageifs/)
- [AVERAGE](https://goingstellar.ro/reference/sheets/average/)
- [SUMIF](https://goingstellar.ro/reference/sheets/sumif/)
- [COUNTIF](https://goingstellar.ro/reference/sheets/countif/)
- [IFERROR](https://goingstellar.ro/reference/sheets/iferror/)
- [MEDIAN](https://goingstellar.ro/reference/sheets/median/)

## Sources

- [AVERAGEIF (Docs Editors Help)](https://support.google.com/docs/answer/3256529)

