Skip to content
CoursesLog in
← Statistics glossary

median

The middle value of the sorted data (the average of the two middle values when n is even); robust to outliers.

The median is the middle value of the data once it is sorted: half of the observations are at or below it, half at or above. It cares only about the order of values, not about how large the extremes are, which is why a single huge order barely moves it.

To find it, sort the nn values from smallest to largest. If nn is odd, take the value in position (n+1)/2(n + 1)/2. If nn is even, there are two middle values, in positions n/2n/2 and n/2+1n/2 + 1, and the median is their mean:

Me={x((n+1)/2),n oddx(n/2)+x(n/2+1)2,n even\text{Me} = \begin{cases} x_{((n+1)/2)}, & n \text{ odd} \\[6pt] \dfrac{x_{(n/2)} + x_{(n/2+1)}}{2}, & n \text{ even} \end{cases}

Here x(k)x_{(k)} is the kk-th value after sorting. In Sheets or Excel, =MEDIAN(range) does the sorting for you.

Use the median when the question is "what does a typical customer, order or session look like?" and the data is skewed, as order values, time to first purchase, revenue per user and page load times usually are. Unlike the mean, the median can't be multiplied by the count to give a total, so keep the mean for revenue forecasts. The median is also the second quartile (Q2) and the 50th percentile; its natural partner for spread is the interquartile range. A big gap between mean and median is a quick signal of skewness or outliers.

Example

Seven CatChow orders on a Saturday, as exported by time: $31, $24, $284, $28, $35, $22, $18.

Odd count. Sort first: 18, 22, 24, 28, 31, 35, 284. With n=7n = 7 the median is in position (7+1)/2=4(7 + 1)/2 = 4, so it is $28. The mean is 442/7≈63.14442 / 7 \approx 63.14 dollars, more than twice the median, because of the $284 shelter order.

Even count. An eighth order of $40 arrives. Sorted: 18, 22, 24, 28, 31, 35, 40, 284. Now n=8n = 8, the middle positions are 4 and 5, and the median is (28+31)/2=29.5(28 + 31) / 2 = 29.5 dollars. Note that it isn't one of the actual orders.

Robustness check. If the shelter's order had been $2,840 instead of $284, the median would still be $29.50, while the mean of the eight orders would jump from 482/8=60.25482 / 8 = 60.25 to 3,038/8=379.753{,}038 / 8 = 379.75 dollars.

Common mistakes

  • Forgetting to sort. The middle row of an export ordered by date or ID is not the median.
  • Picking one of the two middle values when nn is even instead of averaging them. Small samples are where this changes the answer most.
  • Multiplying the median by the order count to forecast revenue. Only the mean is tied to totals; the median will under-forecast right-skewed revenue.
  • Averaging medians across days or segments. The median of the combined data is generally not the mean of the daily medians. Recompute it from the raw rows.
  • Letting the median hide the tail. It deliberately ignores extremes, so when the tail matters (slow deliveries, failed payments) report a high percentile such as p90 alongside it.

Learn it in the course

  • Typical value: mean, median, mode · Mean, median, mode and trimmed mean on real-looking CatChow orders: what each one answers, why one bulk order can fool the average, and how not to average averages.
  • Outliers and skewed data · Why product metrics have long tails, how to find outliers with the IQR rule, and what to do with them: fix errors, segment different customers, and never delete whales without thinking.
  • Spread: range, SD and quartiles · Two couriers with the same average delivery time, and why only one keeps the promise: range, variance, standard deviation, quartiles, IQR and the coefficient of variation.
  • Charts: choosing the right one · Histograms, box plots, bar, pie, scatter and line charts: which question each one answers, how bin width and axes change the story, and the classic ways charts mislead.
  • Samples, populations and the normal distribution · Why we study samples to learn about all users, and why the bell curve shows up everywhere.