How to Find the Median
Sorting first, the middle value for odd counts, the averaged pair for even counts — with duplicates and real salary data worked through.
What the median is
The median is the middle value of a data set once it is sorted — half the values lie below it and half above. It is the average to use when a few extreme values would drag the mean away from the typical case, which is why incomes and house prices are quoted as medians. The median calculator does everything in this guide from one paste, sorted list included; the steps below are for doing it by hand — or checking that the machine did it right.
Odd number of values
Step 1 — Sort the values from smallest to largest. Step 2 — Count them. Step 3 — Take the middle value, which sits in position (n + 1) ÷ 2.
Example: 3, 7, 9, 14, 20 is already sorted; n = 5; the middle position is the 3rd; the median is 9. Duplicates change nothing about the method — each occurrence takes its own position in the sorted list.

Even number of values
With an even count there are two middle values — positions n ÷ 2 and (n ÷ 2) + 1 — and the median is their average.
Example: 5, 8, 12, 20. Sorted, the middle pair is 8 and 12. Median = (8 + 12) ÷ 2 = 10. Note that 10 is not in the set — like the mean, an even-count median can be a value nobody has. If the two middle values happen to be equal, the median is simply that value.
Median with duplicates
Duplicates are values like any others: sort every occurrence into place. The set 4, 4, 4, 9, 10 has median 4 (the 3rd value), and the set 4, 4, 9, 9 has median (4 + 9) ÷ 2 = 6.5. The mistake to avoid is "tidying" the list by removing repeats first — deduplication changes n, changes the positions, and changes the answer.
Median vs mean on real data
The salary set tells the whole story: $32,000, $34,000, $35,000, $36,000, $38,000 and an owner at $240,000. The median is $35,500; the mean is $69,166.67. Sort the six salaries and the median falls between the 3rd and 4th — positions the owner's salary cannot influence beyond occupying one slot at the end. That positional stubbornness is the median's whole virtue, and the reason the mean vs median decision matters in every report that quotes an "average".
Medians in spreadsheets and big data
For lists too long to sort by hand, the median is a single spreadsheet function — =MEDIAN(range) in Excel and Google Sheets — and one paste into the median calculator here, which displays the sorted data so the middle can be seen rather than trusted. The by-hand method in this guide still matters: it is how you check the machine. If a spreadsheet's median for a small set disagrees with your sorted-list answer, the usual culprit is a value stored as text and silently excluded — the same phantom-value family as the blank-cell trap in our mistakes guide. Count first, sort second, take the middle third: the order of operations never changes, whatever the tool.
More guides
Frequently asked questions
How do you find the median of an even number of values?
Sort the values and average the two middle ones: for 5, 8, 12, 20 the middle pair is 8 and 12, so the median is (8 + 12) ÷ 2 = 10.
Does the data have to be sorted first?
Yes — always. The median is defined by position in the sorted list. Finding the 'middle' of an unsorted list is the single most common median mistake.
What is the median of 3, 7, 9, 14, 20?
9 — with five values, the median is the 3rd value of the sorted list.
What if the two middle values are the same?
Then the median is that value: the middle pair 7 and 7 averages to 7.