Median of grouped data
Line up a class of fifty students by height and the middle student's height is the median — the value that splits the data exactly in half, immune to a single freakishly tall or short outlier. That is easy when you can see every individual value. But real data usually arrives already bucketed into class intervals — marks grouped as –, –, and so on — and once the individual values are lost inside a bucket, you cannot simply "pick the middle one." You need a systematic way to track how many observations have piled up by the end of each class, spot the class that contains the middle position, and then estimate exactly where inside that class the median falls. This article builds that machinery: the cumulative frequency table, the median class, and the formula that locates the median within it — the same class-interval setup you already used for mean and mode of grouped data.
Build a cumulative frequency table, find the class where the running total first reaches or passes , and use the median formula to pinpoint the median inside that class.
The core idea
Grouped data hides individual values inside class intervals, so the median cannot be read off directly — it has to be located using running totals.
Cumulative frequency (cf). For a grouped frequency distribution, the cumulative frequency of a class is the sum of all frequencies up to and including that class. It answers the question "how many observations lie at or below the upper limit of this class?" Building this column is always the first step, and it must be done in order, class by class, adding each new frequency to the running total.
The median class. Let be the total number of observations across all classes. The middle position in the data lies at . Scan the cumulative frequency column from the top and find the first class whose cf is greater than or equal to — this is the median class, the interval that actually contains the middle observation.
Locating the median inside the class. Once the median class is known, four quantities from it feed into the median formula:
- = lower limit of the median class
- = total number of observations
- = cumulative frequency of the class immediately before the median class (not the median class's own cf)
- = frequency of the median class (not cumulative)
- = class width (size) of the median class
The formula assumes the observations inside the median class are spread evenly across its width, so it interpolates proportionally from the class's lower limit:
where: , , , , are as defined above, all read from the cumulative frequency table once the median class is identified. This formula requires the class intervals to be continuous (like –, –, with no gaps) and, ideally, of equal width.
The goal is to justify why the median formula uses rather than simply reporting the median class itself, showing that the extra term is a proportional interpolation that assumes the observations of the median class are spread evenly across its width , and that it correctly reduces to the class boundary when the target position sits right at the edge.
Step 1. Set up the picture. The median class starts at and has observations already counted before it begins (from all earlier classes) and more observations spread across it, ending at cumulative total . The target position we want to reach is .
Step 2. Find how far into the median class the target lies, in observation-count terms. Since observations are already done before this class starts, the number of this class's own observations still needed to reach is .
Step 3. Convert that count into a fraction of the class. The median class holds observations spread across width , so each observation is assumed to occupy an equal share of the width. The fraction of the class we must travel is therefore , and the actual distance travelled from is that fraction multiplied by the full width: .
Step 4. Add this distance to the starting point to land on the median: . Check the edge case: if exactly, the fraction is zero and the median equals , the class's own lower limit — exactly right, since the target position was reached at the very start of this class. If , the fraction is and the median lands at , the class's upper limit — again correct, since the target was reached only at the very end of the class.
Worked example
Find the median of the following frequency distribution. Class intervals: –, –, –, –, – with frequencies , , , , respectively.
Step 1. Build the cumulative frequency table by adding each frequency to the running total: cf values are , , , , for the five classes in order.
Step 2. Find and . The total is , so .
Step 3. Locate the median class. Scanning the cf column, the first entry that is is , which belongs to the class –. So the median class is –.
Step 4. Identify the terms from the table: (lower limit of –), (the cumulative frequency of the class before it, namely –), (frequency of – itself), and (class width).
Step 5. Apply the formula. . The median of the distribution is 28.
Competitive stretch
The daily wages (in ₹) of workers are grouped as: –, –, –, –, – with worker counts , , , , .
Step 1. Cumulative frequencies: , , , , .
Step 2. , so . The first cf is , in class –, so that is the median class.
Step 3. Here , (from the class before), , . So . The median daily wage is ₹145.
Common traps
- Using the cf of the median class itself instead of the class immediately before it — in the formula always belongs to the previous class.
- Skipping straight to the class with the highest frequency instead of scanning cf for the first value — that mistake finds the mode's class, not the median's.
- Swapping and : is the plain (non-cumulative) frequency of the median class, while is the running total up to the class before it.
- Applying the formula to non-continuous class intervals (like inclusive-type –, –) without first converting them to continuous form.
Ask the tutor: Want to try a median problem where the class widths are unequal or the data needs converting to continuous intervals first — ask the AI tutor to walk through one with you.
Why do we use cf of the previous class and not the median class itself?
The formula measures how many more observations, beyond what earlier classes already contributed, are needed inside the median class to reach the halfway mark . That "needed" count is minus everything already counted before the median class starts, which is exactly the previous class's cf. Using the median class's own cf would double count part of its own frequency and give a wrong, usually smaller, interpolation distance.
What if two classes tie for the first cf reaching n over 2?
That cannot actually happen for a single class boundary, because cf strictly increases (or stays flat only if a frequency is zero) as you move down the table — each new cf equals the previous cf plus that class's own frequency. The "first class whose cf is greater than or equal to n/2" is always uniquely determined by scanning top to bottom and stopping at the very first class that satisfies the condition.
Does the median formula work if the class widths are different?
The formula as given assumes the median class has a well-defined width that you plug in directly, and it works correctly even if other classes in the table have different widths — only the width of the median class itself enters the formula. What it does require is that class intervals be continuous, with no gaps between the upper limit of one class and the lower limit of the next; inclusive-type intervals must be converted to continuous form first.