Median and Mode for Grouped Data: Find the Right Class
Find the median and modal class, use both formulas, and solve grouped-data questions with cumulative frequencies, class boundaries and checked examples.
- 11th
- Economics
You have added the frequencies correctly. You remember both formulas. Yet the answer still goes wrong because you picked the wrong row.
That is often the real difficulty with median and mode for grouped data. The arithmetic comes later. Your first job is to decide which class interval matters and which numbers belong in the formula.
Think of students standing in order of their travel time to school. The median asks where the halfway point falls. The mode asks where the biggest concentration is. Those places need not be the same.
Let’s solve one table both ways, then tackle the awkward cases that tend to cause mistakes.
Median class and modal class: the difference
For a continuous grouped distribution, use these two starting points:
- Median class: build cumulative frequencies and find the first class whose cumulative frequency exceeds half the total frequency, N/2.
- Modal class: for equal-width classes with one clear peak, find the class with the highest ordinary frequency.
The median class is an interval containing the estimated median. The modal class is an interval containing the estimated mode. Neither interval is the final numerical answer if you are asked to calculate the measure itself.
These selection rules and the formulas below follow NCERT’s Statistics chapter, Sections 13.3 and 13.4. All the numerical exercises here use original figures.
If a cumulative frequency equals N/2 exactly, the estimated median may fall on a class boundary. We will work through that case separately.
One table, two different answers
A stationery shop records the time taken to pack 60 orders. Each order takes at least 0 minutes and less than 50 minutes. The intervals use the exclusive convention: 10 to 20 includes 10 but excludes 20.
| Time in minutes | Orders, f | Running total, cf |
|---|---|---|
| 0 to 10 | 6 | 6 |
| 10 to 20 | 20 | 26 |
| 20 to 30 | 16 | 42 |
| 30 to 40 | 12 | 54 |
| 40 to 50 | 6 | 60 |
| Total | 60 |
Read the second row carefully. Its frequency is 20, but its cumulative frequency is 26. That means 20 orders take from 10 to under 20 minutes, while 26 orders in total take under 20 minutes.
The largest frequency is 20, so the modal class is 10 to 20 minutes.
For the median, N/2 = 60/2 = 30. The cumulative frequency moves from 26 to 42 in the next row. Therefore, the median class is 20 to 30 minutes.
Already, we have found the main trap: the row with the highest frequency is not the median class in this example.
How to calculate the median of grouped data
Use:
Median = L + [(N/2 - cf) / f] × h
Here, L is the lower boundary of the median class; N is total frequency; cf is the cumulative frequency before that class; f is that class’s frequency; and h is its width.
For the packing-time table, write a small substitution list before calculating:
- L = 20 minutes
- N = 60 orders
- cf = 26 orders
- f = 16 orders
- h = 10 minutes
Then:
Median = 20 + [(30 - 26) / 16] × 10
= 20 + 2.5 = 22.5 minutes
The estimate places the halfway point at 22.5 minutes. Roughly half the orders fall below this time and half above it under the grouped-data interpolation.
Why this calculation makes sense
Before the 20 to 30 class begins, we have accounted for 26 orders. We need another 4 to reach the halfway count of 30.
Those 4 are one-quarter of the 16 orders in this class. Treating the orders as spread evenly within the interval, we travel one-quarter of its 10-minute width: 2.5 minutes. Add that distance to 20.
This explanation also gives you an immediate error check. The result should be inside the selected class, or at a boundary in a special case. An answer of 32.5 minutes would not fit the 20 to 30 median class.
Why do we say “estimated median”?
The shop has given intervals, not the original packing times. We do not know how those 16 orders are spread between 20 and 30 minutes. Many different lists of exact times could produce the same table.
The formula supplies an estimate using a within-class assumption. It does not recover the original observations. OpenStax explains this loss of exact information when data are grouped into intervals.
How to calculate the mode of grouped data
For equal-width continuous classes with a clear modal class, use:
Mode = L + [(f1 - f0) / (2f1 - f0 - f2)] × h
Here, L and h belong to the modal class. The three frequencies are:
- f1: frequency of the modal class
- f0: frequency of the class immediately before it
- f2: frequency of the class immediately after it
In our table, the modal class is 10 to 20 minutes. So:
- L = 10
- f1 = 20
- f0 = 6
- f2 = 16
- h = 10
Mode = 10 + [(20 - 6) / (40 - 6 - 16)] × 10
= 10 + (14/18) × 10
= approximately 17.78 minutes
We now have two different summaries: an estimated median of 22.5 minutes and an estimated mode of 17.78 minutes. That is perfectly reasonable. Halfway through the orders is a different question from locating their greatest concentration.
A less confusing way to remember the denominator
Let d1 = f1 - f0 and d2 = f1 - f2. Then:
Mode = L + [d1 / (d1 + d2)] × h
For our example, d1 = 14 and d2 = 4. The denominator is 14 + 4 = 18.
The modal frequency is much higher than its left neighbour but only a little higher than its right neighbour. The estimate consequently lies toward the upper end of the modal interval. This is a useful sense check, not a replacement for the calculation.
NCERT’s Measures of Central Tendency chapter uses this difference-based form and explains that the usual grouped-mode calculation requires equal, continuous intervals.
Inclusive classes: fix the boundaries first
Suppose scores are recorded to the nearest whole mark and grouped as 10 to 19, 20 to 29, 30 to 39, and so on. These are inclusive classes.
For continuous interpolation, the boundary between 19 and 20 is 19.5. The correction is half the one-unit gap, or 0.5.
Consider this separate example:
| Recorded marks | Frequency | Continuous boundaries |
|---|---|---|
| 10 to 19 | 4 | 9.5 to 19.5 |
| 20 to 29 | 8 | 19.5 to 29.5 |
| 30 to 39 | 16 | 29.5 to 39.5 |
| 40 to 49 | 8 | 39.5 to 49.5 |
| 50 to 59 | 4 | 49.5 to 59.5 |
N = 40 and N/2 = 20. The cumulative frequencies are 4, 12, 28, 36 and 40, so the median class has boundaries 29.5 to 39.5.
Median = 29.5 + [(20 - 12) / 16] × 10 = 34.5 marks
The same interval is also the modal class:
Mode = 29.5 + [(16 - 8) / (32 - 8 - 8)] × 10 = 34.5 marks
Here the two answers coincide. They did not coincide in the packing-time example, so do not assume either outcome in advance.
Notice that the width is 39.5 - 29.5 = 10, not 39 - 30 = 9.
Do not subtract 0.5 automatically in every question. Existing continuous intervals such as 10 to 20 and 20 to 30 need no correction. If measurements are recorded to a different precision, use the boundary halfway between adjacent stated limits rather than memorising 0.5 as a universal rule.
Less-than and more-than cumulative tables
A cumulative frequency table hides the separate class frequencies. Recover those frequencies before using the mode formula or the median denominator.
A less-than table
Suppose the packing-time data arrive in this form: fewer than 10 minutes, 6 orders; fewer than 20, 26; fewer than 30, 42; fewer than 40, 54; fewer than 50, 60. The minimum time is stated as 0.
Subtract consecutive cumulative totals:
- 0 to 10: 6
- 10 to 20: 26 - 6 = 20
- 20 to 30: 42 - 26 = 16
- 30 to 40: 54 - 42 = 12
- 40 to 50: 60 - 54 = 6
We have recovered the original table. The total N is the final cumulative frequency, 60. It is not 6 + 26 + 42 + 54 + 60, because those totals repeatedly count the same orders.
A more-than type table
The same data can be described as orders taking at least 0, 10, 20, 30, 40 and 50 minutes, with counts 60, 54, 34, 18, 6 and 0 respectively.
Subtract the next count from the current count:
60 - 54 = 6; 54 - 34 = 20; 34 - 18 = 16; 18 - 6 = 12; 6 - 0 = 6.
Then rebuild the ordinary ascending table and its less-than cumulative frequencies. This extra step makes the standard median formula much safer to use.
If a question does not specify the end boundaries, keep an end class open rather than inventing a limit. You may still be able to calculate the median when its class has known boundaries.
What if N/2 equals a cumulative frequency?
Take continuous intervals 0 to 10, 10 to 20, 20 to 30 and 30 to 40 with frequencies 5, 15, 12 and 8.
N = 40, so N/2 = 20. The cumulative frequencies are 5, 20, 32 and 40.
Using the first cumulative frequency strictly greater than 20 selects the 20 to 30 class:
Median = 20 + [(20 - 20) / 12] × 10 = 20.
Using the preceding class gives its upper boundary:
Median = 10 + [(20 - 5) / 15] × 10 = 20.
Both calculations meet at the common boundary. This agreement depends on the adjacent classes being continuous and having positive frequencies, as they do here.
Do not average the two class midpoints, 15 and 25, as a general method. That happens to give 20 in this equal-width example, but it is not how grouped interpolation works and can fail with unequal widths.
Unequal widths, tied peaks and open ends
Most introductory questions give equal intervals and one clear peak. Check for these conditions before applying a familiar shortcut.
Unequal class widths
Consider classes 0 to 10, 10 to 30 and 30 to 40 with frequencies 8, 12 and 10.
The second class has the most observations, but it covers twice as much width. The frequencies per unit of width are 0.8, 0.6 and 1 respectively. Its larger count therefore does not make it the densest interval.
For unequal widths, histogram height is based on frequency density, while area represents frequency. Stata’s explanation of varying-width histograms sets out this area principle.
Do not apply the ordinary equal-width mode formula blindly to raw frequencies. Follow the adjusted-frequency or histogram method specified in your course or question.
For the median, we can still use the actual width of the selected class. In this example, N = 30, N/2 = 15, and the middle class has cf = 8, f = 12 and h = 20:
Median = 10 + [(15 - 8) / 12] × 20 = approximately 21.67.
The answer lies inside 10 to 30, as expected.
Two classes share the maximum frequency
If two separated classes share the highest frequency, do not choose the earlier one just because you see it first. The grouped distribution has more than one peak candidate. Report the tied classes and use any grouping or analysis method the question explicitly requires.
Adjacent tied maxima can form a flat top rather than two clearly separated peaks. The shape deserves attention; forcing a single answer may hide what the table says.
The median class is open-ended
If the halfway point falls in “50 and above”, its width is unknown. Without an additional assumption or information, the usual interpolation cannot give a specific median.
An open class elsewhere need not prevent the calculation. You need the total frequency, the count before the median class, and known boundaries for the median class itself.
Six short practice questions
Try these before looking at the answers. All intervals are continuous unless stated otherwise.
- Classes are 0 to 10, 10 to 20, 20 to 30, 30 to 40 and 40 to 50. Frequencies are 4, 10, 18, 12 and 6. Find the median and mode.
- Classes are 0 to 10, 10 to 20, 20 to 30 and 30 to 40. Frequencies are 12, 8, 7 and 3. Identify the median class only.
- Whole-number inclusive classes are 1 to 10, 11 to 20 and 21 to 30. Frequencies are 5, 10 and 5. Find the interpolated median.
- The less-than cumulative counts at 10, 20, 30 and 40 are 3, 11, 25 and 30. The minimum is 0. Find the ordinary frequencies and the modal class.
- A modal class has L = 30, h = 10, f0 = 12, f1 = 22 and f2 = 17. Find the estimated mode.
- For classes 0 to 10, 10 to 20 and 20 to 30, frequencies are 5, x and 5. The median is 15. Can you determine x uniquely?
Answers with working
1. Median = approximately 26.11; mode = approximately 25.71. N = 50. Cumulative frequencies are 4, 14, 32, 44 and 50. Both selected classes are 20 to 30. Median = 20 + [(25 - 14)/18] × 10. Mode = 20 + [(18 - 10)/(36 - 10 - 12)] × 10.
2. Median class = 10 to 20. N = 30 and N/2 = 15. The cumulative frequencies begin 12 and 20. The first class has the highest ordinary frequency, but the halfway count falls in the second class.
3. Median = 15.5. Use continuous boundaries 10.5 to 20.5 for the middle class. Median = 10.5 + [(10 - 5)/10] × 10.
4. Frequencies = 3, 8, 14 and 5; modal class = 20 to 30. Subtract successive cumulative totals. Do not choose the last class because 30 is the largest cumulative count.
5. Mode = approximately 36.67. The differences are 10 and 5, so mode = 30 + [10/(10 + 5)] × 10.
6. No unique value. For any positive whole-number x, N = x + 10 and the median calculation becomes 10 + [((x + 10)/2 - 5)/x] × 10 = 15. An extra condition, such as the total frequency, is needed. An equation that reduces to a true statement does not identify the missing frequency.
A quick check before you finish
Write the selected class before substituting. Confirm that N is the sum of ordinary frequencies, cf stops before the median class, and h comes from the boundaries. For mode, label the three neighbouring frequencies in order.
Finally, include the unit and check whether the answer sits in the selected interval. These simple checks catch most row-selection and substitution errors before they cost you marks.
For the graphical connection, work through finding the median with less-than and more-than ogives. The cumulative-frequency curve gives another way to picture the same halfway point.
Frequently asked questions
How do I find the median class quickly?
Calculate N/2 and scan the cumulative frequencies in ascending class order. Select the first class whose cumulative frequency exceeds N/2. If equality occurs at a boundary, check the adjacent classes as shown in the boundary example above.
Is the median class always the class with the highest frequency?
No. In the packing-time example, the modal class is 10 to 20 while the median class is 20 to 30. Median selection uses cumulative position, not the largest individual frequency.
What is the difference between frequency and cumulative frequency?
Frequency counts observations in one class. Cumulative frequency includes that class and all earlier classes. In our example, 16 orders are in 20 to 30 minutes, but 42 orders are below 30 minutes altogether.
Why does the median formula use N/2 instead of (N + 1)/2?
Continuous grouped interpolation locates the point that divides total frequency into halves. Use N/2 in this formula. The familiar position rule for an ordered list of individual observations belongs to a different calculation.
What do f0, f1 and f2 mean in the mode formula?
f1 is the modal-class frequency. f0 is the preceding class frequency and f2 is the following class frequency. Read neighbours by class order, not by ranking the frequencies.
Should I use the lower limit or the lower boundary?
Use the lower continuous boundary. For exclusive intervals, it is already the printed lower limit. For whole-number inclusive intervals such as 30 to 39, convert first; the lower boundary is 29.5.
Can the median and mode be decimals when frequencies are whole numbers?
Yes. Frequencies are counts, while median and mode describe the measured variable. An estimated packing time can be 22.5 minutes even though the number of orders must be a whole number.
Can I calculate mode directly from cumulative frequencies?
First convert them into ordinary class frequencies by subtraction. The largest cumulative frequency is generally just the total, so it cannot identify the modal class.
Is the grouped-data answer the exact median or mode of the original observations?
Usually it is an estimate. Grouping removes the exact values inside each interval. The interpolation gives a useful summary under its assumptions, but it cannot reconstruct the original list.
How much should I round my answer?
Follow the question’s instruction. If none is given, two decimal places are often convenient for these exercises. Keep fractions or extra digits during working, and round only the final answer with its unit.
Looking for commerce tuitions?
Prachi is a gold-medalist commerce teacher with experience at Deloitte and KPMG. She focuses on fundamentals to build a strong foundation.