Median Calculation Formula- Explained with Examples

What Is the Median?

The median is the middle value in a sorted list of numbers. That's it. Half the numbers sit above it, half sit below it.

People confuse median with average all the time. They're not the same. The average (mean) adds everything up and divides. The median just finds the center point.

Why does this matter? Because outliers wreck averages. A CEO earning $10 million skews the "average" salary into meaningless territory. The median salary tells you what an actual person in the middle earns.

The Median Calculation Formula

The formula changes depending on whether you have an odd count or even count of numbers.

Odd Number of Values

When n is odd, the median is the value at position:

Position = (n + 1) / 2

Simple. Take the count, add 1, divide by 2. That position in your sorted list is your median.

Even Number of Values

When n is even, you take the average of the two middle values:

Position 1 = n / 2

Position 2 = (n / 2) + 1

Median = (Value at Position 1 + Value at Position 2) / 2

Step-by-Step Examples

Example 1: Odd Set

Find the median of: 3, 1, 4, 1, 5, 9, 2

Step 1: Sort the numbers. 1, 1, 2, 3, 4, 5, 9

Step 2: Count them. n = 7

Step 3: Find position. (7 + 1) / 2 = 4

Step 4: Find the 4th value. Median = 3

Example 2: Even Set

Find the median of: 8, 3, 7, 4, 1, 6

Step 1: Sort the numbers. 1, 3, 4, 6, 7, 8

Step 2: Count them. n = 6

Step 3: Find the two middle positions. n/2 = 3, so positions 3 and 4

Step 4: Get those values. Position 3 = 4, Position 4 = 6

Step 5: Average them. (4 + 6) / 2 = Median = 5

Median vs Mean vs Mode

These three measures of central tendency get lumped together constantly. Here's how they differ:

Measure What It Is Best For
Mean Sum divided by count Symmetrical data without outliers
Median Middle value Skewed data, salaries, real estate prices
Mode Most frequent value Categorical data, finding the most common item

The median is your best friend when dealing with income data, housing prices, or anything where a few extreme values would distort the average.

How to Calculate Median: Quick Start

Here's the practical process you can use right now:

Shortcut for Programmers

Most programming languages have built-in median functions:

Don't waste time writing median algorithms from scratch unless you're learning the concept.

Common Mistakes That Blow the Calculation

When to Use the Median

Use the median when:

Use the mean when:

The Bottom Line

The median calculation formula isn't complicated. Sort your numbers, find the middle (or average the two middles), done. The hard part is knowing when median is the right tool.

For skewed data with outliers, median always wins. For symmetrical data, mean and median will be close anyway. Pick based on what your data actually looks like, not what you wish it looked like.