The formula of the median and how to use it (with examples)

By Indeed Editorial Team

Published 25 April 2022

The Indeed Editorial Team comprises a diverse and talented team of writers, researchers and subject matter experts equipped with Indeed's data and insights to deliver useful tips to help guide your career journey.

The median can be a relatively simple value to calculate in maths and statistics. But, the formula that you use to calculate the median can vary, depending on the data set that you have. If you wish to pursue a career that involves statistics, then you could benefit from learning about the median and the different ways that you can calculate it. In this article, we discuss what the formula of the median is, why it's important, how to calculate it and look at some median calculation examples.

What is the formula of the median?

The general formula of the median is:

{(n+1)/2}th

‘n' is the number of values in the set and ‘th' stands for the (n)th number. The median is a measure of central tendency that represents the middle value of a given data set when you arrange the values in ascending or descending order.

This measure is a type of average that helps you to find the centre position, which means that it identifies the point at which half the data is more and half the data is less. Statisticians typically use the median to find numbers that are most representative of trends in sets of data.

Related: How to work out the mean: a complete guide with examples

Why is the median important?

The median is important because it represents a large number of data points with a single data point. The calculation is more useful when compared to the mean or mode when dealing with a skewed distribution. This is because the median result isn't affected by outliers that can distort trends.

Median vs. mean vs. mode vs. range

The mean, median, mode and range are all measures of central tendency that help summarise trends in data sets. The median denotes the middle numbers in a set of values. In contrast, the mean is an arithmetic average that provides a ratio of the sum of all values and the total number of values. It involves adding all values in the data set together and dividing them by the total number of values in the set.

The mode refers to the most frequently occurring value in the data set, while the range represents the difference between the highest and lowest value of a given data set.

Related: How to calculate mean in excel and why it's essential

How to calculate the median

Below, you can find out how to calculate the median for an odd or even set of numbers and how to calculate the median for a grouped frequency distribution:

1. For an odd set of numbers

Odd numbers are whole numbers that aren't divisible by two. The formula to calculate the median for an odd set of numbers is:

Median = (n+1)/2

In this formula, n is the number of observations or values in a data set.

Tips for using the formula

To use this formula, sort the numbers into ascending order. This means ordering them from the smallest number to the highest number. Then, use the result of the formula to determine the position of the middlemost value. For instance, if the result of the formula is six, then the median is the sixth number in the sequence.

You may find it simpler to arrange the numbers in ascending order and locate the middlemost number manually if you have a small data set. In this instance, you can determine the middlemost point as the point where there's an equal number of data points above and below the number. But, for larger data sets it's often far quicker to use the formula to calculate the median.

2. For an even set of numbers

Even numbers are numbers that are divisible by two that end in two, four, six, eight and zero. Even data sets differ from odd data sets because there are two numbers in the middle of the data. This requires you to find the median between two numbers. The formulas to calculate the median for an even set of numbers are:

n/2 and then (n/2)+1

Tips for using the formula

To use this formula, arrange the numbers into ascending or descending order. Then, use the two equations to determine the two middlemost numbers of the data set. For instance, if the results are 10 and 11, look for the tenth and eleventh numbers in your ordered sequence. Once you find the two numbers, add them together and then divide by two to calculate the median. This means that the overall formula looks like this:

Median = [(n/2)th + {(n/2)+1}th]/2

3. For a grouped frequency distribution

A grouped frequency distribution shows how often a set of specific responses occur in a sample. These responses are typically organised into equal-sized intervals or subsets, which form a frequency distribution table. Follow these steps below to find the median of a grouped frequency distribution:

1. Determine the total number of observations or intervals.

2. Use (n+1)/2 to find out which interval is the median group. For instance, if the result is three, then the third interval is the median group.

3. Calculate the cumulative percentage of the interval immediately preceding the median group interval and label this value A.

4. Subtract value A from 50% and label this value B.

5. Calculate the range of the median interval and label this value C.

6. Use the following formula to calculate the median:
Median = lower interval value + (B/D) x C

Related: 19 jobs that use statistics (plus duties and salaries)

Examples of median calculations

Below, you can find examples of how to calculate the median for an odd and even set of numbers and how to calculate the mean, median, mode and range of a given data set:

Calculating the median for an odd set of numbers

Here's an example of how to calculate the median value of an odd set of numbers:

Example: Michael wants to determine the median hourly wage of supermarkets in his local area. He collects data from 11 different restaurants and produces a data set that includes the numbers 14, 15.50, 11, 9.50, 14.50, 15, 13, 10.50, 8.50, 14.75 and 13.25. First, Michael arranges the numbers in ascending order to get 8.50, 9.50, 10.50, 11, 13, 13.25, 14, 14.50, 14.75, 15 and 15.50.

Michael then uses the following equation to find the position of the middlemost data point: (n+1)/2. Since Michael has 11 numbers, he inputs the following into the formula: (11+1)/2 = 6. This means that the median in his ordered data is the sixth value. The median hourly wage is, therefore, £13.25 per hour.

Calculating the median for an even set of numbers

Here's an example of how you can calculate the median of an even set of numbers:

Example: Danielle wants to find out the median number of pets among her group of six friends. She collects her data and comes up with the following list of numbers, which are 4, 1, 3, 4, 2 and 5. Danielle begins to calculate the median by arranging these numbers in order from the lowest to the greatest value to get 1, 2, 3, 4, 4 and 5. She then uses the following formulas to find the two middlemost data points in her data, which are n/2 and then (n/2)+1.

Since Danielle has six numbers in her sequence, she inputs the following into the formula: 6/2 = 3 and (6/2)+1 = 4. This means that the middle two values are the third and fourth numbers in her ordered sequence, which are the numbers three and four. She then adds the two values together and divides them by two to find the median between these two numbers: (3+4)/2 = 3.5. This means that the median number of pets among Danielle's friends is 3.5 pets.

Calculating the mean, median, mode and range

Here's an example of how to calculate the mean, median, mode and range of a given data set:

Example: Callum is a data analyst and wants to find the central tendencies of a data set that includes nine numbers, which are 12, 62, 23, 54, 36, 72, 19, 23 and 43. To find the median, Callum first arranges the numbers in ascending order to produce the following sequence: 12, 19, 23, 23, 36, 43, 54, 62 and 72. He then uses this calculation to determine the position of the median number: (9+1)/2 = 5. This means that the median is the fifth number, which is 36.

To calculate the mean, Callum adds up all the numbers and divides them by the total amount of numbers in the sequence. The formula for this is: (12+19+23+23+36+43+54+62+72)/ 9 = 38.2. This means that the mean of the data set is 38.2. To find the mode, Callum looks for the number that appears the most often. 23 appears twice, making it the mode of the data set. To find the range, Callum subtracts the highest value from the lowest value to calculate the difference. He does the following calculation: 72–12 = 60. This means that the range is 60.

Disclaimer: The model shown is for illustration purposes only, and may require additional formatting to meet accepted standards.

Related:

• A complete guide to outliers statistics: issues and examples

• What is skewed data? (Importance and how to calculate)

• What does 'skewing statistics' mean? (Formulas and examples)

• How to find a sample mean: definition and examples

• Mean vs median: their definitions and how to use them