Median Calculator Formula

Understand the math behind the median calculator. Each variable explained with a worked example.

Formulas Used

Median

median = a + b + c - min(min(a, b), c) - max(max(a, b), c)

Minimum

minimum = min(min(a, b), c)

Maximum

maximum = max(max(a, b), c)

Mean

mean = (a + b + c) / 3

Variables

VariableDescriptionDefault
aValue 17
bValue 23
cValue 312

How It Works

How to Find the Median

Method

1. Sort the numbers from smallest to largest 2. The median is the middle number

For 3 values, the median equals the sum minus the minimum minus the maximum:

Median = a + b + c - min(a,b,c) - max(a,b,c)

Worked Example

Find the median of 7, 3, and 12.

a = 7b = 3c = 12
  1. 01Sort the values: 3, 7, 12
  2. 02The middle value is 7
  3. 03Alternatively: 7 + 3 + 12 - min(3,7,12) - max(3,7,12) = 22 - 3 - 12 = 7

Frequently Asked Questions

What is the median?

The median is the middle value when numbers are arranged in order. For an odd count, it is the exact middle number. For an even count, it is the average of the two middle numbers.

When is the median better than the mean?

The median is more robust to outliers. For example, incomes of [30k, 35k, 40k, 45k, 1M] have a mean of $230k but a median of $40k, which better represents the typical value.

Learn More

Guide

How to Calculate Mean, Median, and Mode - Complete Guide

Learn how to calculate mean, median, and mode with clear explanations and examples. Understand when to use each measure of central tendency.

Ready to run the numbers?

Open Median Calculator