Median Formula
Find the median of a data set.
The median is the middle value when data is sorted.
Learn how to handle both odd and even data sets.
The Formula
Even count: Median = average of values at positions n/2 and (n/2 + 1)
The median is the middle value in a sorted data set. Unlike the mean, the median is not affected by extreme outliers.
Variables
| Symbol | Meaning |
|---|---|
| n | The total number of data values |
| (n + 1) / 2 | Position of the median when n is odd |
| n/2 and n/2 + 1 | Positions of the two middle values when n is even |
Example 1 — Odd Number of Values
Find the median of: 7, 3, 12, 5, 9
Step 1: Sort the data — 3, 5, 7, 9, 12
Step 2: n = 5 (odd), so median position = (5 + 1) / 2 = 3rd value
Median = 7 — The third value in the sorted list.
Example 2 — Even Number of Values
Find the median of: 4, 8, 15, 22, 30, 42
Step 1: Data is already sorted — 4, 8, 15, 22, 30, 42
Step 2: n = 6 (even), so take the 3rd and 4th values
Step 3: Median = (15 + 22) / 2
Median = 18.5 — The average of the two middle values.
When to Use It
Use the median when:
- Your data has outliers that would distort the mean (e.g., income data)
- You want to find the "typical" value in a skewed distribution
- Reporting real estate prices, salaries, or other data with extreme highs or lows
- You need a more robust measure of central tendency
Key Notes
- Calculation: sort the data, then: For odd n: median = value at position (n+1)/2. For even n: median = average of values at positions n/2 and (n/2)+1. The data must be sorted in ascending or descending order first — the median is a positional measure.
- Median vs mean for skewed data: The mean is pulled toward outliers and extreme values; the median is not. For right-skewed distributions (like income), median is typically lower than mean. "Median household income" is more representative than "mean household income" because a few billionaires inflate the mean.
- Interpolation for grouped data: Median = L + [(n/2 − F)/f] × h, where L is the lower boundary of the median class, F is the cumulative frequency before the median class, f is the frequency of the median class, and h is the class width. Used when only grouped frequency data is available.
- Median absolute deviation (MAD): median(|xᵢ − median(x)|): The median of absolute deviations from the median is a robust measure of spread — resistant to outliers in the same way the median is. MAD ≈ 0.675 σ for normal distributions, providing a robust estimate of σ.
- Applications: The median is used in income and wealth statistics, real estate price reporting, medical reference ranges (growth charts use percentiles, not means), response time analysis in software performance, and any context where outliers would distort the mean into a misleading summary statistic.