How to use AVERAGEIF (and AVERAGEIFS)
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Average only the numbers whose row meets a condition — mean sales for one region, average score above zero.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 60 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
AVERAGEIF — see full Excel, Google Sheets & LibreOffice compatibility for each.