Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Number System and Arithmetic
  • Algebra
  • Set Theory
  • Probability
  • Statistics
  • Geometry
  • Calculus
  • Logarithms
  • Mensuration
  • Matrices
  • Trigonometry
  • Mathematics
Open In App
Next Article:
Mode in Statistics | Definition, Formula, How to Calculate Mode
Next article icon

Median in Statistics

Last Updated : 04 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Median is defined as the middle term of the given set of data if the data is arranged either in ascending or descending order.

Example: Suppose we have the height of 5 friends as 167 cm, 169 cm, 171 cm, 174 cm, 179 cm. Now clearly observing the data we see that 171 cm is the middle term in the given data thus, we can say that the median height of the friends is, 171 cm.

In this article, we will learn about the median, its formula for grouped and ungrouped data, examples of the median, and others in detail.

Table of Content

  • Median Definition
  • Median Formula
  • Median of Ungrouped Data
  • Median of Grouped Data
  • How to Find Median?
  • Application of Median Formula
  • Solved Examples on Median

Median Definition

The median is the middle value of the dataset when arranged in ascending or descending order. If the dataset has an odd number of values, the median is the middle value. If the dataset has an even number of values, the median is the average of the two middle values.

A median divides the data into two halves. Median is among one of the three measures of central tendency and finding the median gives us very useful insight into the given set of data.

The three measures of the central tendency are,

  • Mean
  • Median
  • Mode

Median Example

Various examples of the median are:

Example 1: Median salary of five friends, where the individual salary of each friend is,

  • 74,000,
  • 82,000,
  • 75,000,
  • 96,000, and
  • 88,000.

First arranged in ascending order 74,000, 75,000, 82,000, 88,000, and 96,000 then by observing the data we get the median salary as 82,000.

Example 2: Median Age of a Group- Consider a group of people's ages:

25, 30, 27, 22, 35, and 40.

First, arrange the ages in ascending order: 22, 25, 27, 30, 35, 40. The median age is the middle value, which is 30 in this case.

Median Value Formula

As we know median is the middle term of any data, and finding the middle term when the data is linearly arranged is very easy, the method of calculating the median varies when the given number of data is even or odd.

For example,

  • If we have 3 (odd-numbered) data 1, 2, and 3 then 2 is the middle term as it has one number to its left and one number to its right. So finding the middle term is quite simple.
  • But when we are given with even number of data (say 4 data sets), 1, 2, 3, and 4, then finding the median is quite tricky as by observing we can see that there is no single middle term then for finding the median we use a different concept.

Here, we will learn about the median of grouped and ungrouped data in detail.

Median of Ungrouped Data

The median formula is calculated by two methods,

  • Median Formula (when n is Odd)
  • Median Formula (when n is Even)

Now let's learn about these formulas in detail.

Median Formula (When n is Odd)

If the number of values (n value) in the data set is odd then the formula to calculate the median is,

Median Formula (When n is Odd)

Median Formula (When n is Even)

If the number of values (n value) in the data set is even then the formula to calculate the median is:

Median Formula (When n is Even)

Median of Grouped Data

Grouped data is the data where the class interval frequency and cumulative frequency of the data are given. The median of the grouped data median is calculated using the formula,

Median = l + [(n/2 – cf) / f]×h

where,

  • l is the Lower Limit of the Median Class
  • n is the Number of Observations
  • f is Frequency of Median Class
  • h is Class Size
  • cf is the Cumulative Frequency of Class Preceding Median Class

We can understand the use of the formula by studying the example discussed below,

Example: Find the Median of the following data,

If the marks scored by the students in a class test out of 50 are,

Marks0-1010-2020-3030-4040-50
Number of Students58665

Solution:

For finding the Median we have to build a table with cumulative frequency as,

Marks0-1010-2020-3030-4040-50
Number of Students58665
Cumulative Frequency0+5 = 55+8 = 1313+6 = 1919+6 = 2525+5 = 30

n = ∑fi = 5+8+6+6+5 = 30(even)

n/2 = 30/2 = 15

Median Class = 20-30

Now using the formula,

Median = l + [(n/2 – cf) / f]×h

Comparing with the given data we get,

  • l = 20
  • n = 30
  • f = 6
  • h = 10
  • cf = 13

Median = 20 + [(15 - 13)/6] × 10

= 20 + (2/6) x 10

= 60/3 + 10/3

= 20 + 3.3333 = 23.33 (approx)

Thus, the median mark of the class test is 23.33

How to Find Median?

To find the median of the data we can use the steps discussed below,

Step 1: Arrange the given data in ascending or descending order.

Step 2: Count the number of data values(n)

Step 3: Use the formula to find the median if n is even, or the median formula when n is odd, accordingly based on the value of n from step 2.

Step 4: Simplify to get the required median.

Study the following example to get an idea about the steps used.

Example: Find the median of given data set 30, 40, 10, 20, and 50

Solution:

Median of the data 30, 40, 10, 20, and 50 is,

Step 1: Order the given data in ascending order as:

10, 20, 30, 40, 50

Step 2: Check if n (number of terms of data set) is even or odd and find the median of the data with respective ‘n’ value.

Step 3: Here, n = 5 (odd)

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

Median = [(5 + 1)/2]th term = 33r term = 30

Thus, the median is 30.

Application of Median Formula

The median formula has various applications, this can be understood with the following example, in a cricket match the scores of the five batsmen A, B C, D, and E are 29, 78, 11, 98, and 65 then the median run of the five batsmen is,

First arrange the run in ascending order as, 11, 29, 65, 78, and 98. Now by observing we can clearly see that the middle term is 65. thus the median run score is 65.

Median of Two Numbers

For two numbers finding the middle term is a bit tricky as for two numbers there is no middle term, so we find the median as we find the mean by adding them and then dividing it by two. Thus, we can say that the median of the two numbers is the same as the mean of the two numbers. Thus, the median of the two numbers a and b is,

Median = (a + b)/2

Now let's understand this using an example, find the median of the following 23 and 27

Solution:

Median = (23 + 27)/2

Median = 50/2

Median = 25

Thus, median of 23 and 27 is 25.

Read More,

  • Statistics
  • Measure of central tendency
  • Mean, Median, and Mode

Solved Examples on Median

Example 1: Find the median of the given data set 60, 70, 10, 30, and 50

Solution:

Median of the data 60, 70, 10, 30, and 50 is,

Step 1: Order the given data in ascending order as:

10, 30, 50, 60, 70

Step 2: Check if n (number of terms of data set) is even or odd and find the median of the data with respective ‘n’ value.

Step 3: Here, n = 5 (odd)

Median = [(n + 1)/2]th term
Median = [(5 + 1)/2]th term = 3rd term
= 50

Example 2: Find the median of the given data set 13, 47, 19, 25, 75, 66, and 50

Solution:

Median of the data 13, 47, 19, 25, 75, 66, and 50 is,

Step 1: Order the given data in ascending order as:

13, 19, 25, 47, 50, 66, 75

Step 2: Check if n (number of terms of data set) is even or odd and find the median of the data with respective ‘n’ value.

Step 3: Here, n = 7 (odd)

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

Median = [(7 + 1)/2]th term = 4th term

            = 47

Example 3: Find the Median of the following data,

If the marks scored by the students in a class test out of 100 are,

Marks0-2020-4040-6060-8080-100
Number of Students57945

Solution:

For finding the Median we have to build a table with cumulative frequency as,

Marks0-2020-4040-6060-8080-100
Number of Students57945
Cumulative Frequency0+5 = 55+7 = 1212+9 = 2121+4 = 2525+5 = 30

n = ∑fi = 5+7+9+4+5 = 30(even)
n/2 = 30/2 = 15

Median Class = 40-60

Now using the formula,
Median = l + [(n/2 – cf) / f]×h

Comparing with the given data we get,

  • l = 40
  • n = 30
  • f = 9
  • h = 10
  • cf = 12

Median = 20 + [(15 - 12)/6]×10
= 40 - (3/9) x 20
= 40 +6.6667
= 46.6667

Thus, the median mark of the class test is 46.67.

Example 4: Find the median number of hours studied per week

The following table shows the distribution of the number of hours spent studying per week by a group of students:

Hours Studied (Per week)

0 - 5

5 - 10

10 - 15

15 - 20

20 - 25

Frequency

8

15

25

12

10

Solution:

For finding the Median we have to build a table with cumulative frequency as,

Hours Studied (Per week)

0 - 5

5 - 10

10 - 15

k)15 - 20

20 - 25

Frequency

8

15

25

12

10

Cumulative Frequency

0 + 8 = 8

8 + 15 = 23

23 + 25 = 48

48 + 12 = 60

60 + 10 = 70

n = ∑fi = 8 + 15 + 25 + 12 + 10 = 70(even)

n/2 = 70/2 = 35

Median Class = 10 - 15

Now using the formula,

Median = l + [(n/2 – cf) / f]×h

Comparing with the given data we get,

  • l = 10
  • n = 70
  • f = 25
  • h = 5
  • cf = 23

Median = 10 + [(35 - 23)/25]×5

= 10 - (12/15) x 5
= 10 - (0.48) x 5
= 10 + 2.4
= 12.4

Thus, the median number of hours per week is 12.4 hours.

Conclusion

The median is an important statistical measure that helps us find the middle value of a dataset. It is especially useful when the data contains extreme values, as it provides a better representation of the central tendency compared to the mean. Calculating the median is simple and offers an easy way to understand the distribution of values in a set.


Next Article
Mode in Statistics | Definition, Formula, How to Calculate Mode

A

ABHISHEK TIWARI 13
Improve
Article Tags :
  • Mathematics
  • School Learning
  • Maths
  • Median
  • Statistics

Similar Reads

    Statistics in Maths
    Statistics is the science of collecting, organizing, analyzing, and interpreting information to uncover patterns, trends, and insights. Statistics allows us to see the bigger picture and tackle real-world problems like measuring the popularity of a new product, predicting the weather, or tracking he
    3 min read

    Introduction to Statistics

    Introduction of Statistics and its Types
    Statistics is a branch of mathematics that deals with collecting, organizing, and analyzing numerical data to solve real-world problems. It is widely regarded as a distinct scientific discipline due to its vast applications across various fields.Helps make sense of complex data through quantitative
    15+ min read
    Bar Graphs and Histograms
    A Bar graph or a Histogram is a tool used for visual representation of data. Representing the data in a bar graphs or histograms, makes it easy to understand the concepts and relationships among data.A Histogram is used to display the distribution of continuous data by grouping values into intervals
    6 min read
    Pie Chart
    Pie chart is a popular and visually intuitive tool used in data representation, making complex information easier to understand at a glance. This circular graph divides data into slices, each representing a proportion of the whole, allowing for a clear comparison of different categories making it ea
    11 min read
    Frequency Distribution - Table, Graphs, Formula
    A frequency distribution is a way to organize data and see how often each value appears. It shows how many times each value or range of values occurs in a dataset. This helps us understand patterns, like which values are common and which are rare. Frequency distributions are often shown in tables or
    11 min read
    Types of Frequency Distribution
    Frequency distribution is a method of organizing and summarizing data to show the frequency (count) of each possible outcome of a dataset. It is an essential tool in statistics for understanding the distribution and pattern of data. There are several types of frequency distributions used based on th
    10 min read

    Mean

    Mean in Statistics
    In statistics, three measures are defined as central tendencies that are: Mean, Median, and Mode, where the mean provides the average value of the dataset, the median provides the central value of the dataset, and the most frequent value in the dataset is the mode.Calculation of central tendency, su
    15+ min read
    How to find Mean of grouped data by direct method?
    Statistics involves gathering, organizing, analyzing, interpreting, and presenting data to form opinions and make decisions. Applications range from educators computing average student scores and government officials conducting censuses to demographic analysis. Understanding and utilizing statistica
    8 min read
    How to Calculate Mean using Step Deviation Method?
    Step Deviation Method is a simplified way to calculate the mean of a grouped frequency distribution, especially when the class intervals are uniform. In simple words, statistics implies the process of gathering, sorting, examining, interpreting and then understandably presenting the data to enable o
    6 min read

    Median

    Median in Statistics
    Median is defined as the middle term of the given set of data if the data is arranged either in ascending or descending order.Example: Suppose we have the height of 5 friends as 167 cm, 169 cm, 171 cm, 174 cm, 179 cm. Now clearly observing the data we see that 171 cm is the middle term in the given
    10 min read

    Mode

    Mode in Statistics | Definition, Formula, How to Calculate Mode
    In statistics, the mode is the data point that comes the most frequently among a group of data members. It is one of three measures of central tendency, alongside the mean and median. To determine the mode, count how frequently each number appears. The number that comes the most frequently is the mo
    11 min read
    How To Find the Mode If No Number is Repeated?
    In statistics, for a given data distribution the mode is the value or number that occurs most frequently. It is representative of the value or integer that occurs the maximum number of times. However, there may or may not be a modal value for a given set of datasets. This is because the given data s
    6 min read
    Empirical Formula
    Empirical Formula in chemistry is defined as the simplest ratio of the elements present in the compound. It does not take into account that these elements are connected with each other in any manner. This is explained in the formula of Glucose as we know that the formula for Glucose is C6H12O6 here
    6 min read
    Frequency Distribution - Table, Graphs, Formula
    A frequency distribution is a way to organize data and see how often each value appears. It shows how many times each value or range of values occurs in a dataset. This helps us understand patterns, like which values are common and which are rare. Frequency distributions are often shown in tables or
    11 min read
    Cumulative frequency Curve
    In statistics, graph plays an important role. With the help of these graphs, we can easily understand the data. So in this article, we will learn how to represent the cumulative frequency distribution graphically.Cumulative FrequencyThe frequency is the number of times the event occurs in the given
    9 min read
    Mean Deviation
    The mean deviation (also known as Mean Absolute Deviation, or MAD) of the data set is the value that tells us how far each data is from the center point of the data set. The center point of the data set can be the Mean, Median, or Mode. Thus, the mean of the deviation is the average of the absolute
    12 min read
    Standard Deviation - Formula, Examples & How to Calculate
    Standard deviation is a statistical measure that describes how much variation or dispersion there is in a set of data points. It helps us understand how spread out the values in a dataset are compared to the mean (average). A higher standard deviation means the data points are more spread out, while
    15+ min read
    Variance
    Variance is a number that tells us how spread out the values in a data set are from the mean (average). It shows whether the numbers are close to the average or far away from it.If the variance is small, it means most numbers are close to the mean. If the variance is large, it means the numbers are
    12 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences