Statistical function

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], ...)
ArgumentWhat it means
number1RequiredThe first number, cell or range. All values must be greater than 0.
number2, ...OptionalUp 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

D2fx=HARMEAN(B2:B3)
ABCD
1Legkm/h
2Outbound6048
3Return40

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

D2fx=HARMEAN(B2:B5)
ABCD
1StockP/E
2A1219.62
3B18
4C25
5D40

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

D2fx=HARMEAN(B2:B4)
ABCD
1MonthPrice per unit
2Jan55.22
3Feb4
4Mar8

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.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
DanishHARMIDDELVÆRDI
DutchHARM.GEM
FinnishKESKIARVO.HARM
FrenchMOYENNE.HARMONIQUE
GermanHARMITTEL
HungarianHARM.KÖZÉP
ItalianMEDIA.ARMONICA
Norwegian (Bokmål)GJENNOMSNITT.HARMONISK
PolishŚREDNIA.HARMONICZNA
Portuguese (Brazil)MÉDIA.HARMÔNICA
Portuguese (Portugal)MÉDIA.HARMÓNICA
RussianСРГАРМ
SpanishMEDIA.ARMO
SwedishHARMMEDEL
TurkishHARORT