Mean and median from a frequency table

When the same value repeats over and over in a data set — exam marks across a whole class, the number of siblings each student has — writing out every single observation is tedious and error-prone. A frequency table fixes this: it lists each distinct value once, together with how many times it occurs, and turns a long messy list into a short, organised summary. This article picks up right where raw-data mean and median left off. You already know the mean as "sum over count" and the median as "the middle value of ordered data" for a plain list of numbers; here you learn to compute both of these directly from a frequency table, using a weighted-sum shortcut for the mean and a running cumulative-frequency count for the median — without ever writing out every repeated value by hand.

The core insight

A frequency table lets you compute the mean by weighting each value by how often it occurs (Mean=∑fixi/∑fi\text{Mean}=\sum f_ix_i/\sum f_i) and the median by tracking a cumulative-frequency count to locate the middle position of the full ordered list.

The core idea

A frequency table lists each distinct value xix_i found in a data set together with its frequency fif_i — the number of times xix_i occurs. If there are kk distinct values in the table, the total number of observations is the sum of all the frequencies:

n=f1+f2+⋯+fk=∑fin = f_1+f_2+\cdots+f_k = \sum f_i

where: nn is the total count of raw observations (even though only kk rows are written down), and each fif_i tells you how many times its own xix_i would have appeared in the original, un-summarised list.

Mean from a frequency table. Rather than adding a repeated value to itself fif_i times, multiply the value by its frequency once and add up those products:

Mean=∑fixi∑fi=f1x1+f2x2+⋯+fkxkf1+f2+⋯+fk\text{Mean} = \dfrac{\sum f_i x_i}{\sum f_i} = \dfrac{f_1x_1+f_2x_2+\cdots+f_kx_k}{f_1+f_2+\cdots+f_k}

where: fixif_ix_i is a shortcut for "xix_i added to itself fif_i times," so the numerator is exactly the sum of every raw observation and the denominator is exactly the total count nn — this is the same mean formula you already know, just computed efficiently.

Median from a frequency table. The median is still "the middle value of the ordered list," but a frequency table lets you locate that middle position without writing every value out. Build a cumulative frequency column — a running total of the frequencies, read top to bottom with values already in ascending order. Then: For odd nn, the median sits at position n+12\dfrac{n+1}{2} in the ordered list: find the first row whose cumulative frequency reaches or passes this position, and its xix_i is the median. For even nn, find the values at positions n2\dfrac{n}{2} and n2+1\dfrac{n}{2}+1 the same way, and average them (they may be the same value or two different ones).

Figure
A frequency table with a cumulative frequency column beside it, an arrow pointing from the running totals to the row where the middle position is first reached
Cumulative frequency finds the middle position value x frequency f cumulative f 022 168 2715 3419 4120 positions 10 and 11 both land here: x = 2 Cumulative frequency first reaches or passes the wanted position — read x from that row.
Derivation AWhy the frequency-table mean equals the raw-data mean

The goal is to show, with nothing beyond expanding a sum, that computing Mean=∑fixi/∑fi\text{Mean}=\sum f_ix_i/\sum f_i from a frequency table gives exactly the same number as adding up every individual raw observation and dividing by how many there are — so the frequency-table shortcut is not an approximation but an identical restatement of the ordinary mean.

Step 1. Write the raw-data mean as it is originally defined: add every single observation and divide by the total count nn. If the value x1x_1 occurs f1f_1 times, x2x_2 occurs f2f_2 times, and so on up to xkx_k occurring fkf_k times, the full raw sum is x1+x1+⋯+x1⏟f1 times+x2+x2+⋯+x2⏟f2 times+⋯+xk+xk+⋯+xk⏟fk times\underbrace{x_1+x_1+\cdots+x_1}_{f_1\text{ times}} + \underbrace{x_2+x_2+\cdots+x_2}_{f_2\text{ times}} + \cdots + \underbrace{x_k+x_k+\cdots+x_k}_{f_k\text{ times}}.

Step 2. Collapse each repeated block. Adding xix_i to itself fif_i times is, by the definition of multiplication, the same as computing fi×xif_i\times x_i once. Doing this for every block turns the long raw sum into f1x1+f2x2+⋯+fkxk=∑fixif_1x_1 + f_2x_2 + \cdots + f_kx_k = \sum f_ix_i — a much shorter sum with exactly one term per distinct value.

Step 3. Count the total number of raw observations the same way: the count is f1+f2+⋯+fk=∑fi=nf_1+f_2+\cdots+f_k = \sum f_i = n, since every occurrence of every value is counted once in its own frequency.

Step 4. Divide the collapsed sum by the collapsed count. The raw-data mean, sum of all raw observationsn\dfrac{\text{sum of all raw observations}}{n}, therefore equals ∑fixi∑fi\dfrac{\sum f_ix_i}{\sum f_i} term for term — no information was lost in collapsing repeats into frequencies, so the two computations must agree exactly.

Worked example

Question. A survey of 20 families records the number of children in each family in this frequency table:

Number of children (xix_i)01234
Number of families (fif_i)26741

Find the mean and the median number of children.

Step 1. Check the total frequency. 2+6+7+4+1=202+6+7+4+1=20, matching the 20 families surveyed — this confirms no row was missed before computing anything.

Step 2. Compute fixif_ix_i for each row and sum them for the mean: 0×2=00\times2=0, 1×6=61\times6=6, 2×7=142\times7=14, 3×4=123\times4=12, 4×1=44\times1=4, giving 0+6+14+12+4=360+6+14+12+4=36. Dividing by the total frequency,

Mean=3620=1.8\text{Mean} = \dfrac{36}{20} = 1.8

So the average family in this survey has 1.8 children — a non-whole summary value, even though no single family actually has 1.8 children.

Step 3. For the median, n=20n=20 is even, so the middle positions are 202=10\dfrac{20}{2}=10 and 202+1=11\dfrac{20}{2}+1=11. Build the cumulative frequency column: 2, 8, 15, 19, 202,\ 8,\ 15,\ 19,\ 20 against xi=0,1,2,3,4x_i=0,1,2,3,4.

Step 4. Locate positions 10 and 11. Cumulative frequency reaches 8 at x=1x=1 and reaches 15 at x=2x=2, so observations 9 through 15 in the ordered list are all equal to 2. Both position 10 and position 11 fall in this range, so both middle values equal 2, and

Median=2+22=2\text{Median} = \dfrac{2+2}{2} = 2

Answer. The mean is 1.8 children and the median is 2 children. The two are close, which suggests this data set has no strong outlier pulling the mean away from the middle.

Common traps

  • Multiplying frequencies together instead of fi×xif_i\times x_i. The mean formula needs each value multiplied by its own frequency, then summed — not frequencies multiplied by each other.
  • Dividing by the number of distinct values (kk) instead of the total frequency (nn). In the worked example there are only 5 rows, but the mean's divisor must be 20 (total families), not 5.
  • Finding the median's middle position by counting table rows instead of cumulative frequency. The middle position must be located among the total observations, not among the kk distinct values.
  • Stopping one row too early when reading cumulative frequency. The median value is the first xix_i whose cumulative frequency reaches or passes the required position — picking the row just before it gives the wrong answer.

Ask the tutor: If your cumulative frequency column isn't landing on the position you expect, walk the AI tutor through your table row by row to find where the count goes wrong.

Why does multiplying each value by its frequency give the same mean as adding every repeated value?

Because fi×xif_i\times x_i is exactly a shortcut for adding xix_i to itself fif_i times. If a family size of 2 occurs 7 times, adding 2+2+2+2+2+2+22+2+2+2+2+2+2 gives the same 14 as computing 2×72\times7 once. Doing this for every row and summing gives the same total as writing out and adding every single raw observation — the frequency table just lets you skip the repetition.

Why do I need cumulative frequency instead of just picking the middle row of the table?

The middle row of the table is not the same as the middle observation. A table row can represent many repeated observations, so the actual middle of the full ordered list can land inside a row that isn't anywhere near the table's midpoint. Cumulative frequency tracks the running count of real observations as you go down the table, so it tells you exactly which row contains observation number 10, or 11, or whatever position you need.

What if the cumulative frequency lands exactly on the boundary between two rows?

That is fine and handled the same way. Suppose cumulative frequency reaches exactly 10 at one row and the wanted position is 10 — that row's value is the answer, since the 10th observation is the last one counted at that row. If you need two positions for an even nn (say positions 10 and 11) and they fall in different rows, average the two corresponding xix_i values, even if those values are different.

Before this

Where this leads