HARMEAN function
Returns the harmonic mean of positive numbers, the correct average for rates such as speeds, prices per unit or P/E ratios.
Available in All versions of Excel, including Microsoft 365 and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
HARMEAN(number1, [number2], ...)| Argument | What it means | |
|---|---|---|
number1 | Required | The first number, cell or range. All values must be greater than 0. |
number2, ... | Optional | Up to 255 numbers or ranges in total. |
Returns: n divided by the sum of the reciprocals (1/x) of the values.
How HARMEAN works
When you average rates that share the same "denominator" amount, the ordinary average gives the wrong answer. A van drives 120 km to a customer at 60 km/h and 120 km back at 40 km/h. The average speed is not 50 km/h: the slow leg takes longer, so the true average over the whole trip is 48 km/h. The harmonic mean handles this automatically by averaging the reciprocals (hours per km) and turning the result back into a rate.
It is used for average speeds over equal distances, average cost when you spend the same budget at different unit prices (dollar-cost averaging), and average price-to-earnings ratios in finance. Every value must be positive. Text, logical values and empty cells in ranges are ignored. For any set of positive numbers HARMEAN ≤ GEOMEAN ≤ AVERAGE.
Examples
1Average speed for a round trip
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Leg | km/h | ||
| 2 | Outbound | 60 | 48 | |
| 3 | Return | 40 |
Result: 48
2 / (1/60 + 1/40) = 48. Both legs are the same distance, so the slower leg weighs more because more time is spent on it.
2Average P/E ratio of a portfolio
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Stock | P/E | ||
| 2 | A | 12 | 19.62 | |
| 3 | B | 18 | ||
| 4 | C | 25 | ||
| 5 | D | 40 |
Result: 19.62
With equal money in each stock, the portfolio's P/E is the harmonic mean, 19.618529 (shown to 2 decimals). The simple average would be 23.75, overstating it because one expensive stock dominates.
3Same budget, different prices
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Month | Price per unit | ||
| 2 | Jan | 5 | 5.22 | |
| 3 | Feb | 4 | ||
| 4 | Mar | 8 |
Result: 5.22
A buyer spends the same amount each month. The average price actually paid per unit is 5.217391 (shown to 2 decimals), lower than the plain average of 5.67, because the cheap month bought more units.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | A value is 0 or negative. | Remove zeros; the harmonic mean is undefined for them. |
#VALUE! | A directly typed argument is text that cannot be converted. | Use numbers or cell references. |
Tips
- Use HARMEAN only when each rate covers the same amount of the "per" unit (same distance, same budget). If the times or quantities differ, use a weighted average with SUMPRODUCT.
- HARMEAN is very sensitive to small values: one near-zero rate pulls the result down sharply.
Google Sheets
HARMEAN also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
HARMEAN in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Danish | HARMIDDELVÆRDI |
| Dutch | HARM.GEM |
| Finnish | KESKIARVO.HARM |
| French | MOYENNE.HARMONIQUE |
| German | HARMITTEL |
| Hungarian | HARM.KÖZÉP |
| Italian | MEDIA.ARMONICA |
| Norwegian (Bokmål) | GJENNOMSNITT.HARMONISK |
| Polish | ŚREDNIA.HARMONICZNA |
| Portuguese (Brazil) | MÉDIA.HARMÔNICA |
| Portuguese (Portugal) | MÉDIA.HARMÓNICA |
| Russian | СРГАРМ |
| Spanish | MEDIA.ARMO |
| Swedish | HARMMEDEL |
| Turkish | HARORT |