How to Find the Median, Step by Step

Find the median by hand: sort, count, then take the middle value or average the two middle values. Worked odd and even examples, plus frequency tables.

How to Find the Median: The Opening Move

You are staring at a column of house prices, and the one number that will tell you what a typical sale actually costs is not the average, it is the median. The median is the middle value of a sorted list, and it resists being dragged around by a single crazy high or low sale. To get it, you do exactly two things: sort every number from smallest to largest, then pick the middle one. That is the whole job, and here is how to find the median step by step, without a calculator.

Step 1: Sort the Data

Take the raw list and rewrite it in ascending order, smallest on the left, largest on the right. This is not a formality; the median is defined by position in the ordered list, not by the order the numbers happened to arrive in. If you skip this step, every later move is wrong, because the middle position of an unsorted list is meaningless.

Use a column in a spreadsheet, a scrap of paper, or a sorting app. For a hand count, cross off each number as you place it. For a list of twenty or more, sort in chunks: pick the smallest five, then the next five, and so on. Duplicates stay in the list; a repeated value counts once per occurrence.

Step 2: Count n and Find the Position (n+1)/2

Count every value in the sorted list; call that number n. The median calculation depends entirely on whether n is odd or even. For an odd count, the median sits at position (n+1)/2. For an even count, there is no single middle position; instead, the median is the average of the values at positions n/2 and n/2 + 1.

Write the positions out: for n = 7, the middle is the 4th value. For n = 8, the two middle positions are the 4th and 5th. Do the arithmetic before you look at the numbers; it keeps you honest.

Odd n Example: The Single Middle Value

Take the dataset {3, 1, 9, 7, 5}. Sort it to {1, 3, 5, 7, 9}. Count n = 5, which is odd. The middle position is (5+1)/2 = 3. The 3rd value in the sorted list is 5, so the median is 5.

Notice what did not happen: no averaging, no rounding, no special case for the extremes. The median ignores the magnitude of every value except the one that lands in the middle. That is why a single extreme sale does not pull the median the way it would the mean; the median only cares about order.

Even n Example: Averaging the Two Middle Values

Now take {4, 1, 6, 3, 9, 2}. Sort to {1, 2, 3, 4, 6, 9}. Count n = 6, which is even. The two middle positions are n/2 = 3 and n/2 + 1 = 4. The 3rd value is 3, the 4th is 4. The median is (3 + 4) / 2 = 3.5.

This is the median of even numbers: you must average the two middle values, not pick one and not average the first and last. If the two middle values are the same, the median equals that repeated value. For example, in {2, 5, 5, 8}, the two middle values are 5 and 5, so the median is 5.

Median Formula for Negative and Decimal Values

The median calculation does not care whether the numbers are negative, decimal, or whole. Sort {-5, -1, 0, 2} to get n = 4, then average the 2nd and 3rd values: (-1 + 0) / 2 = -0.5. For decimals, sort {0.1, 0.05, 0.2} to {0.05, 0.1, 0.2}, n = 3, median is the 2nd value, 0.1.

Do not round before you find the median; round only the final answer if your context demands it. Sorting negative numbers trips people up: -10 is smaller than -5, so it comes first. Write the full list, then check the order once before you count.

Median From a Frequency Table: Cumulative Counts

A frequency table lists values with their counts. To find the median from a frequency table, you have two options. For a small table, expand it: write each value as many times as its frequency, then sort and apply the odd/even rule. For example, the table {2: 1, 4: 3, 6: 2} expands to {2, 4, 4, 4, 6, 6}, n = 6, median = (4 + 4) / 2 = 4.

For a large table, use cumulative frequency. Add the frequencies from the top until the running total reaches or passes (n+1)/2 for odd n, or n/2 and n/2 + 1 for even n. The value at that cumulative position is the median. This is the median from a frequency table method for ungrouped data; it works because cumulative counts turn the table into a sorted list.

Median From a Frequency Table: Grouped Data

When the table has class intervals, like "10-20" or "100 or more", you cannot find the exact median, only an estimate. The standard method for grouped data is: Median = L + ((n/2 - F) / f) × h, where L is the lower boundary of the median class, n is the total frequency, F is the cumulative frequency before the median class, f is the frequency of the median class, and h is the class width.

First, find the median class by locating the cumulative frequency that reaches or exceeds n/2. Then plug into the calculation. For open-ended classes like "100 or more", you must assume an upper bound; without that assumption, the estimate is not defined. The key is that the cumulative count identifies the class, and the calculation refines the position within it.

Common Mistakes: Not Sorting and Averaging the Wrong Pair

The most common failure is skipping the sort. The median is undefined on unsorted data; a spreadsheet sorts automatically, but hand calculation does not. Always write the sorted list before you count positions.

The second failure is averaging the wrong pair for even n. Many people average the first and last values, or the two values closest to the middle without confirming their positions. The correct pair is always the n/2-th and (n/2 + 1)-th values in the sorted list. For n = 10, that is the 5th and 6th, not the 4th and 7th.

A third mistake is confusing the median with the mean in skewed data. The median is robust to outliers; the mean is not. If your dataset has a single extreme value, the median barely moves, but the mean can swing wildly. For nominal data, categories have no order, so the median does not apply at all.

What to Do When the Median Is Not Obvious

For a dataset with one value, the median is that value. For two values, it is their average. For a long list, the position rule scales: n = 100, median is the average of the 50th and 51st values. If the two middle values are far apart, the median is still their average; there is no rule to discard either.

When the median from a frequency table gives a value that does not appear in the data, that is normal for grouped data. The estimate is an interpolation, not an observed value. If you need the exact median, go back to the raw list or use ungrouped data. For a bimodal distribution, the median may sit in a low-frequency gap between two peaks; report it with the modes, not instead of them.

When the Median Lies: The Honest Caveat

The median is not always the right number. For a bimodal distribution, it can sit in a gap where no data exist, and for grouped data with open-ended classes, it is an estimate that depends on an assumed upper bound. If you need the exact middle of a raw dataset, use the steps above; if you need an estimate for a histogram, the grouped calculation is your tool. But if you need a single number that reflects the total of all values, the median will mislead you; that is the mean's job. Know which question you are asking before you pick the statistic.

Common Questions

What is the median calculation for odd n?

For an odd count, the median is the value at position (n+1)/2 in the sorted list. For example, with n = 5, the median is the 3rd value.

How do you calculate the median of even numbers?

Sort the list, then average the two middle values. The positions are n/2 and n/2 + 1. For n = 6, that is the 3rd and 4th values, summed and divided by 2.

What happens if the two middle values are the same in an even dataset?

The median equals that repeated value. For example, in {2, 4, 4, 6}, the two middle values are 4 and 4, so the median is 4.

How do you find the median from a frequency table?

For ungrouped data, expand the table or use cumulative frequency to locate the (n+1)/2-th value for odd n, or the n/2-th and (n/2+1)-th for even n. For grouped data, use the calculation L + ((n/2 - F)/f) × h.

Can the median be a decimal when all data are whole numbers?

Yes, but only for an even count. If the two middle values are, say, 3 and 4, the median is 3.5. For odd n, the median is always one of the data values.

Do I need to sort the data before finding the median?

Yes. The median is defined by position in the ordered list. Sorting is the first step, and skipping it is the most common mistake in hand calculation.

What does the median tell me that the mean does not?

The median is robust to extreme values; the mean is not. In a skewed distribution, the median represents the middle observation, while the mean can be pulled toward a tail. For totals or sums, use the mean, not the median.