How to Find the Median of a Data Set

Half your data sits above one number and half sits below it, so how do you find that middle point? That number is the median. To find it, you sort the values from smallest to largest and then locate the one in the very center. This guide shows you how to find the median in three clear steps, with worked examples for both odd and even counts.

Quick Answer
To find the median, follow three steps. First, sort every value from smallest to largest. Second, count the values: if the count is odd, the median is the single middle number. Third, if the count is even, take the two middle numbers and average them. Always sort first, or your answer will be wrong.

Step 1: Sort the Numbers

The median is the middle of your data, so the values must be in order first. Arrange them from smallest to largest. This one step is where most mistakes happen.

Say your data is 7, 3, 9, 5, 1. In order, it becomes 1, 3, 5, 7, 9. Now the numbers line up on a number line, and the true middle is easy to spot.

You can sort in either direction, smallest to largest or largest to smallest. The middle value stays the same. Keep every value, including repeats, because each one holds a position.

Step 2: Find the Middle (Odd Count)

When you have an odd number of values, one value sits exactly in the center. That single middle value is your median. There is no averaging needed.

Take the sorted set 1, 3, 5, 7, 9. It has five values, which is odd. The middle one is the third value, so the median is 5. Two values fall below it and two fall above it.

A quick formula finds the middle position for any odd count. For n values, the middle is the (n + 1) / 2 th position. Here that is (5 + 1) / 2 = 3, the third value.

Sorting five numbers then picking the single middle value The unsorted numbers 7, 3, 9, 5, 1 are sorted into 1, 3, 5, 7, 9. The third value, 5, is highlighted as the median. Odd Count: Pick the Single Middle Unsorted 7 3 9 5 1 sort Sorted 1 3 5 7 9 Median = 5
Sort the five numbers, then the third value, 5, is the median.

Even Number of Values

When you have an even number of values, no single value sits in the center. Two values share the middle instead. The median is the average of those two middle numbers.

Take the data 4, 1, 7, 2. Sorted, it is 1, 2, 4, 7, which has four values. The two middle numbers are the second and third: 2 and 4.

Add them and divide by two: (2 + 4) / 2 = 3. So the median is 3. Notice that 3 is not in the original data, and that is perfectly normal for an even count.

Averaging the two middle values of an even count The sorted values 1, 2, 4, 7 have two middle numbers, 2 and 4. Their average, (2 plus 4) divided by 2, equals 3, the median. Even Count: Average the Two Middle Values Sorted values 1 2 4 7 two middle values (2 + 4) / 2 = 3 Median = 3
With four values, average the second and third numbers to get the median, 3.

Handling Repeated Values

Repeated numbers do not change the method at all. You still sort every value and keep each copy in its own spot. Duplicates count just like any other number when you find the middle.

Take the data 4, 4, 6, 9, 9, 9. It is already sorted, and it has six values, an even count. The two middle numbers are the third and fourth: 6 and 9.

Average them: (6 + 9) / 2 = 7.5. So the median is 7.5. If you had dropped one of the repeated nines, your count would change and your answer would be wrong.

The rule is simple. Never remove duplicates before finding the median, because each value holds a real position in the ordered list. Repeats shift where the middle lands, which is exactly what they should do.

A Full Worked Example

Let’s find the median of seven test scores: 82, 75, 91, 68, 88, 79, 95. Because seven is odd, we expect a single middle value. Here is each step in order.

  1. Write down all the values: 82, 75, 91, 68, 88, 79, 95.
  2. Sort them from smallest to largest: 68, 75, 79, 82, 88, 91, 95.
  3. Count the values. There are seven, which is an odd number.
  4. Find the middle position with the formula (n + 1) / 2 = (7 + 1) / 2 = 4.
  5. Take the fourth value in the sorted list, which is 82.
  6. The median is 82. Three scores fall below it and three fall above it.

The mean of these scores would land near 82.6, close but not equal. The median simply reports the middle score, which the mean does not always do.

To double-check, recount the sorted list and confirm the fourth value really is 82. A quick recount catches slips before they cost you marks. With an odd count like this one, the median is always one of the original values.

Common Mistakes When Finding the Median

Most median errors come from small slips, not hard math. Watch out for these traps, and check each one before you trust your answer.

  • Forgetting to sort: the biggest mistake. Picking the middle of an unsorted list gives the wrong value almost every time.
  • Averaging the wrong pair: for an even count, average only the two center values, not the smallest and largest.
  • Miscounting the position: recount your values and use (n + 1) / 2 to confirm the middle spot for an odd count.
  • Dropping repeated values: keep every duplicate. Each copy takes up its own place in the order.
  • Confusing median with mean: the median is the middle value, not the average of all values. See the sibling guide below.

Want the answer instantly without sorting by hand? Paste your numbers into our Median Calculator. It sorts the data, handles odd and even counts, and shows the middle value for you in one click.

For how the median compares with the average and the most frequent value, read mean, median, and mode. To go further and split data into quarters, see percentiles and quartiles explained.

Frequently Asked Questions About Finding the Median

What Is the Median of a Data Set?

The median is the middle value of a data set once the numbers are sorted from smallest to largest. Half of the values fall at or below it, and half fall at or above it. It marks the center of your data, and unlike the mean, extreme values do not pull it far in one direction.

How Do You Find the Median Step by Step?

First, sort all the values from smallest to largest. Second, count how many values you have. If the count is odd, the median is the single middle value. If the count is even, average the two middle values. Sorting first is essential, because the median depends entirely on the order of the numbers.

What Is the Median When There Is an Even Number of Values?

With an even count, no single value sits in the center, so two values share the middle. You add those two middle numbers and divide by two. For the sorted set 1, 2, 4, 7, the middle pair is 2 and 4, so the median is (2 + 4) / 2 = 3.

Do You Have to Sort the Data First?

Yes, sorting is required. The median is defined as the middle value in order, so an unsorted list gives the wrong answer almost every time. Arrange the numbers from smallest to largest, keeping all repeats, before you look for the middle. This single step prevents the most common median mistake.

What Is the Position Formula for the Median?

For an odd number of values, the middle sits at the (n + 1) / 2 position, where n is the count. With five values, that is (5 + 1) / 2 = 3, so the third value is the median. For an even count, the two middle positions are n / 2 and n / 2 plus 1, and you average them.

How Is the Median Different From the Mean?

The mean is the average, found by adding all values and dividing by the count. The median is the middle value after sorting. The mean can be pulled by very high or very low numbers, while the median is not. For a full comparison, see our mean, median, and mode guide linked above.

Can the Median Be a Number Not in the Data Set?

Yes, it can. When you have an even number of values, the median is the average of the two middle numbers, and that average may not appear in your original data. For 1, 2, 4, 7, the median is 3, which is not in the set. For an odd count, the median is always an actual data value.

Sources

References Used in This Article

This article is for general education only, not professional statistical advice. Methods and notation can vary by field, course, or software, so follow your textbook or instructor for exact conventions. Reviewed for accuracy by Prof. Dr. Khalil Mudassar, PhD. Last updated September 11, 2026.


Author

shakeel-Muzaffar
Founder & Editor-in-Chief at  ~ Web ~  More Posts

Shakeel Muzaffar is the Founder and Editor-in-Chief of MultiCalculators.com, bringing over 15 years of experience in digital publishing, product strategy, and online tool development. He leads the platform's editorial vision, ensuring every calculator meets strict standards for accuracy, usability, and real-world value. Shakeel personally oversees content quality, formula verification workflows, and the platform's commitment to publishing tools that are genuinely useful for students, professionals, and everyday users worldwide.

Leave a Comment