How to use AVERAGEIF (and AVERAGEIFS)
✓ Verified in LibreOffice 25.8.7.3Average only the numbers whose row meets a condition — mean sales for one region, average score above zero.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =AVERAGEIF(A2:A10,"East",B2:B10) | AVERAGEIF(test range, criteria, average range). AVERAGEIFS for multiple conditions (average range FIRST). |
| Google Sheets | =AVERAGEIF(A2:A10,"East",B2:B10) | Identical. |
| LibreOffice Calc | =AVERAGEIF(A2:A10,"East",B2:B10) | Identical. |
How it works
AVERAGEIF works exactly like SUMIF but takes the mean instead of the total: it checks the first range for the criteria and averages the matching values from the third range. The two East rows are 100 and 20, so the average is 60 (the West row is ignored). The criteria can be text, a number, a comparison in quotes (">0" to average only positives), or a wildcard. For more than one condition use AVERAGEIFS, which — like SUMIFS — puts the range-to-average FIRST, then the range/criteria pairs. One gotcha: if no rows match, both return #DIV/0! (wrap in IFERROR if an empty result is possible), and truly blank cells are skipped rather than counted as zero.
Verified, not just documented
We ran =AVERAGEIF(A2:A4,"East",B2:B4) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 60 — exactly the expected result. Every formula here is confirmed by actually executing it.