Calculating Median and Mode of a Data Set


Median refers to the midpoint or the middle value of a data set after sorting the values in ascending or descending order.

Our data set sorted in ascending order is presented below:

1.2, 1.5, 1.7, 2.3, 2.5, 2.9, 3, 3.8, 4.2, 4.3, 5.4, 5.5, 5.6, 5.9, 6.2, 6.7, 8.5, 8.8, 9.5, 9.8

Note that our data set has 20 values, so we don’t have one middle point. There are two values namely, 4.3 and 5.4. The median in this case will be the arithmetic mean of these two values.

Median = (4.3+5.4)/2 = 4.85

This will be the case for all data sets containing an even number of observations.

When we have an odd number of observations (such as 5, 7, or 9), the median is simply the middle value. For example in case of 5 observations, the median will be the 3rd value.


Mode refers to the most frequently occurring value in a data set.

Let’s look at our data set:

1.2, 1.5, 1.7, 2.3, 2.5, 2.9, 3, 3.8, 4.2, 4.3, 5.4, 5.5, 5.6, 5.9, 6.2, 6.7, 8.5, 8.8, 9.5, 9.8

All the values in this data set are different. This means that this data set has no mode.

Let’s look at another data set:

1, 3, 4, 4, 5, 7

In this data set the value 4 occurs twice while the rest of the values occur only once. So, the value 4 has the highest frequency of occurring. The mode of this data set is 4. Such a distribution is called unimodal.

If two values had occurred in the data set with highest frequency, the distribution  will be called bimodal. A data set having 3 values with highest frequency will be called trimodal, and so on. For example, the following data set has value 4 and 5 occurring with highest frequency.

1, 3, 4, 4, 5, 5, 7

Related Downloads

Learn the skills required to excel in data science and data analytics covering R, Python, machine learning, and AI.

Free Guides - Getting Started with R and Python

Enter your name and email address below and we will email you the guides for R programming and Python.

Saylient AI Logo

Take the Next Step in Your Data Career

Join our membership for lifetime unlimited access to all our data analytics and data science learning content and resources.