How do you calculate an average?
Short answer. Add up every value, then divide by how many there are. For 4, 8, 9 and 15 that is 36 ÷ 4 = 9, the mean. When a few values sit far from the rest, use the median instead: sort the set and take the middle value.
The arithmetic takes ten seconds. The interesting part is that the average of a set can be a number no member of that set is anywhere near, and nothing in the formula warns you.
The formula
sum of the values
mean = ───────────────────
number of values
Two things to get right. The sum includes every value, zeros included. The count is how many numbers you added, not how many were interesting.
Worked example
Five test scores: 88, 92, 79, 94, 85.
step 1 add them
88 + 92 = 180
180 + 79 = 259
259 + 94 = 353
353 + 85 = 438
step 2 count them
five scores, so n = 5
step 3 divide
438 ÷ 5 = 87.6
Check it before you write it down: an average always lands between the smallest and the largest value. 87.6 sits between 79 and 94, so it is at least plausible. If your answer falls outside that range you have miscounted or fat fingered the sum.
Averages are not obliged to be tidy. 7, 7 and 8 total 22, and 22 ÷ 3 is 7.333333... forever. That is the honest answer. Rounding it to 7.33 is fine for a report and quietly wrong if you are going to multiply it back out later.
Adding one more value
You do not need to start over. Keep the running total, add the new number, divide by the new count:
old set 4, 8, 9, 15 total 36, n = 4, mean 9 add a 4 new total 36 + 4 = 40 new count 4 + 1 = 5 new mean 40 ÷ 5 = 8
Running the same trick backwards answers the question every student actually has. To hit a target average, multiply the target by the number of results you will end up with, then subtract what you already have:
scores so far 78, 84, 90 total 252, mean 84 target 87 across 4 tests total needed 87 × 4 = 348 next score 348 − 252 = 96 check: (78 + 84 + 90 + 96) ÷ 4 = 348 ÷ 4 = 87
If that subtraction hands you a number above 100, the target is out of reach and the formula has just told you so.
Mean, median, mode
All three get called the average, and they answer different questions.
| Name | How you get it | What it tells you |
|---|---|---|
| Mean | Sum ÷ count | The value everyone would get if the total were shared out equally |
| Median | Sort, take the middleEven count: mean of the middle two | The typical member. Half the set is above it, half below |
| Mode | The value that appears most often | The most common outcome. The only one that works on words |
On a small set they can all differ. Take 4, 7, 7, 9, 12:
mean (4 + 7 + 7 + 9 + 12) ÷ 5 = 39 ÷ 5 = 7.8 median 4, 7, 7, 9, 12 = 7 mode 7 appears twice = 7
With an even count the median has no single middle, so you average the pair that straddles it. For 3, 7, 8, 14 the middle pair is 7 and 8:
median (7 + 8) ÷ 2 = 7.5 mean 32 ÷ 4 = 8
When the mean lies
Here are five salaries at a small company:
42,000 45,000 47,000 51,000 315,000 total 500,000 mean 500,000 ÷ 5 = 100,000 median the middle value = 47,000
Four of the five people earn less than half the average. The mean is not wrong, it is just answering a question nobody asked: what everyone would get if the payroll were split evenly. The median answers the question people mean when they ask what a typical salary is here.
The rule of thumb: when the mean and the median are far apart, the set has a long tail, and the median is the number worth quoting. Incomes, house prices, response times and view counts are all like this. Test scores and heights usually are not.
Two averages that quietly break
Averaging averages. Two classes sit the same exam. Class A has 20 students averaging 80. Class B has 5 students averaging 90. The combined average is not 85:
naive (80 + 90) ÷ 2 = 85 wrong
real 20 × 80 = 1,600
5 × 90 = 450
─────
2,050 over 25 students
2,050 ÷ 25 = 82
Averaging the averages gives 5 students the same voting power as 20. You need a weighted average, which means going back to the totals. The two agree only when every group is the same size.
Averaging rates. You drive 60 km out at 30 km/h and the same 60 km back at 60 km/h. Average speed is not 45 km/h, because you spent twice as long crawling:
out 60 ÷ 30 = 2 hours
back 60 ÷ 60 = 1 hour
───────
3 hours for 120 km
average speed = 120 ÷ 3 = 40 km/h
Anything measured "per something" has this problem. Average the underlying totals, distance and time here, and divide once at the end. The same trap shows up with percentages, which is why yearly rises of 5, 8 and 12 percent do not average to 8.3333%.
The rounding you did not ask for
Averages are division, and division is where decimals get long. A calculator that stores 22 ÷ 3 as 7.333333 has already thrown away the tail, and if you multiply that back by 3 you get 21.999999 rather than 22. It gets worse with binary floating point, where even short decimals are approximations. Add 0.1, 0.2 and 0.3 on most machines and you get 0.6000000000000001, so the average comes back as 0.20000000000000004 instead of 0.2.
A calculator doing exact rational arithmetic keeps 22/3 as 22/3 and hands you 0.2 on the nose, because 0.1 + 0.2 really is 0.3 when nothing rounds on the way through. It is the same machinery that lets you convert a decimal to a fraction and get back exactly what you started with.
Long lists, no lost digits
Prism keeps every entry in a searchable history, so you can add up a column, divide by the count, and scroll back to check what you actually typed. History and percentages are free forever, no subscription. See the app.