EasyUnitConverter.com

Median Calculator

Find the median, quartiles, and interquartile range of a data set. See also Mean Calculator and Mode Calculator.

How to Find the Median

The median is the middle value of a sorted data set. To find it: (1) sort the numbers from smallest to largest, (2) if the count is odd, the median is the middle number, (3) if the count is even, the median is the average of the two middle numbers. The median is less affected by outliers than the mean, making it a robust measure of central tendency.

Median Formula

If n is odd: Median = x[(n+1)/2]

If n is even: Median = (x[n/2] + x[n/2 + 1]) / 2

Q1 = Median of lower half

Q3 = Median of upper half

IQR = Q3 − Q1

Example Calculation

Data: 12, 5, 22, 30, 7, 36, 14, 42, 15, 53

Sorted: 5, 7, 12, 14, 15, 22, 30, 36, 42, 53

n = 10 (even) → Median = (15 + 22) / 2 = 18.5

Q1 = 12, Q3 = 36, IQR = 24

Median vs Mean vs Mode

MeasureDefinitionBest For
MeanSum ÷ CountSymmetric data
MedianMiddle valueSkewed data, outliers
ModeMost frequent valueCategorical data

Solved Examples

Example 1: Patient Wait Times

A hospital records wait times (in minutes) for 9 patients: 12, 45, 8, 23, 15, 67, 19, 31, 14. Find the median wait time.

Sorted: 8, 12, 14, 15, 19, 23, 31, 45, 67

n = 9 (odd)

Position = (9+1)/2 = 5th value

Median = 19 minutes

Answer: The median wait time is 19 minutes. Note that the mean is 26 minutes, pulled up by the outlier (67 min). The median better represents the typical patient experience.

Example 2: Home Prices in a Neighborhood

Six houses sold recently for: $245,000, $310,000, $289,000, $1,200,000, $275,000, $295,000. Find the median sale price and explain why it is preferred over the mean here.

Sorted: 245000, 275000, 289000, 295000, 310000, 1200000

n = 6 (even)

Median = (289000 + 295000)/2 = 292000

Mean = 2614000/6 = 435667

Answer: The median sale price is $292,000. The mean ($435,667) is inflated by the luxury home at $1.2M. Real estate reports typically use the median because it resists the distortion caused by a few very expensive properties.

Example 3: Finding Quartiles and IQR

Test scores for 12 students: 55, 62, 67, 70, 72, 75, 78, 82, 85, 88, 91, 96. Find Q1, Q2, Q3, and the IQR.

Data is already sorted, n = 12

Q2 (Median) = (75 + 78)/2 = 76.5

Lower half: 55, 62, 67, 70, 72, 75

Q1 = (67 + 70)/2 = 68.5

Upper half: 78, 82, 85, 88, 91, 96

Q3 = (85 + 88)/2 = 86.5

IQR = Q3 - Q1 = 86.5 - 68.5 = 18

Answer: Q1 = 68.5, Q2 (median) = 76.5, Q3 = 86.5, and IQR = 18. The middle 50% of scores fall within an 18-point range.

Practice Questions

Question 1

The ages of employees in a small office are: 28, 34, 41, 29, 55, 33, 37. Find the median age.

Answer: Sorted: 28, 29, 33, 34, 37, 41, 55. n = 7 (odd). Median = 4th value = 34 years.

Question 2

Monthly rainfall (mm) for 8 months: 45, 52, 38, 61, 49, 55, 43, 58. Find the median and IQR.

Answer: Sorted: 38, 43, 45, 49, 52, 55, 58, 61. n = 8 (even). Median = (49+52)/2 = 50.5 mm. Q1 = (43+45)/2 = 44. Q3 = (55+58)/2 = 56.5. IQR = 56.5 - 44 = 12.5 mm.

Question 3

A dataset has values: 5, 5, 5, 5, 5, 100. Without calculating, is the median or mean a better measure of central tendency?

Answer: The median is 5 (average of 3rd and 4th values), while the mean is (25+100)/6 = 20.83. The median better represents the typical value because the 100 is an extreme outlier that inflates the mean.

Common Mistakes

Forgetting to sort the data first

The median requires sorted data. Taking the middle value of unsorted data gives an incorrect result. Always arrange values from smallest to largest before finding the median position.

Wrong formula for even-count datasets

When n is even, the median is the average of the two middle values, not just one of them. For (2, 4, 6, 8), the median is (4+6)/2 = 5, not 4 or 6.

Confusing median position with median value

For n = 7, the median is at position 4, but the median value is the 4th number in the sorted list, not the number 4 itself. The position formula (n+1)/2 gives you where to look, not the answer.

Key Takeaways

  • The median is the middle value of sorted data and is robust against outliers, unlike the mean.
  • For odd n, the median is the value at position (n+1)/2. For even n, average the two middle values.
  • The median is preferred for skewed distributions (income, home prices, wait times).
  • Quartiles divide sorted data into four equal parts; the IQR (Q3 - Q1) measures the spread of the middle 50%.
  • In a symmetric distribution, the mean and median are equal. Skewness causes them to differ.

Frequently Asked Questions

When is the median better than the mean?

The median is better when data has outliers or is skewed. For example, in income data where a few very high earners pull the mean up, the median gives a more representative "typical" value.

What is the interquartile range (IQR)?

The IQR is the range of the middle 50% of data — the difference between Q3 (75th percentile) and Q1 (25th percentile). It measures spread without being affected by extreme values.

Can the median equal the mean?

Yes. In a perfectly symmetric distribution, the mean and median are equal. For example, in {1, 2, 3, 4, 5}, both the mean and median are 3.

How do you find the median of an even number of values?

Sort the values, then take the average of the two middle numbers. For example, in {2, 4, 6, 8}, the median is (4 + 6) / 2 = 5.

Related Calculators: