Principles of Statistics for Data Analysis

Making sense of a pile of numbers

The middle one: the median

Use MEDIAN to find the middle value, including for an even count, and see why one extreme value hardly moves it.

By the end of this lesson you can find the median with a formula, handle an even number of values, and explain why one extreme value hardly moves it.

Why it matters

A few very large values can make the mean look much bigger than a typical value. When you want "the typical day" or "the typical country", you need a centre that a handful of giants cannot push around. That centre is the median, and you will use it all through your career.

The idea in plain words

You already met it in Lesson 1. Line the values up in order and take the one in the middle. That middle value has a name.

Median: the middle value when the values are sorted. At least half the values are at or below it, and at least half are at or above it.

What if there is an even number of values? Then there is no single middle one. There are two. The median is halfway between them: add the two middle values and divide by 2.

Here are all 30 of Amara's days, sorted. With 30 values, the two middle ones are the 15th and the 16th.

The median sits between the two middle days. The festival day only adds one tall bar at the end: it does not change which bars are in the middle. Synthetic data.

Now the clever part. Make the festival day even bigger, a million naira if you like. It is still the last bar. The 15th and 16th bars do not change, so the median does not change. That is why the median resists extreme values.

See it done

Data: amara-stall-s1-takings.csv (synthetic). Rows 2 to 31 are Amara's 30 days. Day 20, the festival day, is in row 21.

  1. Type =MEDIAN(D2:D31). It gives ₦32,150.
  2. Check it by hand. =SMALL(D2:D31, 15) gives ₦32,100 and =SMALL(D2:D31, 16) gives ₦32,200. Halfway between: (₦32,100 + ₦32,200) ÷ 2 = ₦32,150. It matches.
  3. Compare with the mean: =ROUND(AVERAGE(D2:D31), 0) gives ₦36,422. The mean is higher, pulled up by the festival day.
  4. Now take the festival day out (skip row 21):
    • =MEDIAN(D2:D20, D22:D31) gives ₦32,100. The median hardly moved.
    • =ROUND(AVERAGE(D2:D20, D22:D31), 0) gives ₦32,322. The mean dropped a lot.

Real world: how rich is a "typical" country?

Data: wdi-2024.csv (real). World Bank figures for 188 countries and economies in 2024. Column E, gdp_per_person_usd, is the value of everything an economy produced in a year, shared out equally per person, in US dollars. Rows 2 to 189.

  1. =MEDIAN(E2:E189) gives $7,717.50.
  2. =ROUND(AVERAGE(E2:E189), 0) gives $22,706. The mean is about three times the median!
  3. How many economies are below the mean? =COUNTIF(E2:E189, "<"&AVERAGE(E2:E189)) gives 129 of the 188. (You met COUNTIF in Lesson 2: here the test is "less than the average".)

Histogram: a chart that sorts values into bands of equal width (here $10,000 wide) and draws one bar per band. The taller the bar, the more values fall in that band. You will make your own in Module 3.

One row is one economy, not one person. Monaco (the highest value in the file) and India count once each, even though India has far more people. So these are the mean and median of the 188 economies, not of all the people in the world.

Most economies are on the left. A few very rich ones stretch far to the right and pull the mean up. Source: World Bank, World Development Indicators, 2024 values, CC BY 4.0. Changes: see the data credits in the module introduction.

So if someone asks for the GDP per person of a typical economy, the median, $7,717.50, is the more honest answer. The mean, $22,706, is higher than what most economies have.

Tip. MEDIAN is the same in Google Sheets and Excel. It skips empty cells and text, and it does the "halfway between the two middle values" step for you.

Your turn, with help

Find the median of Amara's first 8 days (D2:D9). Then check it by hand.

Hints: 8 is even, so the two middle values are the 4th and the 5th. Use =SMALL(D2:D9, 4) and =SMALL(D2:D9, 5), then add them and divide by 2. Compare with =MEDIAN(D2:D9).

Show the answer

In order, the first 8 days are ₦27,000, ₦28,800, ₦30,600, ₦31,500, ₦33,600, ₦35,350, ₦36,550, ₦37,700. The 4th is ₦31,500 and the 5th is ₦33,600. Halfway: (₦31,500 + ₦33,600) ÷ 2 = ₦32,550. =MEDIAN(D2:D9) gives the same.

Notice: the median of 8 days is not one of Amara's actual days. That is normal for an even count.

Your turn, alone

  1. In wdi-2024.csv, column F is life_expectancy_years: how many years a baby born in 2024 would live if that year's death rates never changed. Find its median.
  2. In the same file, find the mean of column F, rounded to 1 decimal place. Is it close to the median, or far away?
  3. Kofi's days are in rows 32 to 38 of the takings file. Find his median. Is it the same as his mean (₦31,914)?
  4. Write one sentence for a news report: what is the GDP per person of a typical economy in 2024, and why did you choose that number?

Watch out

  • Forgetting the even case. With an even count there are two middle values. Doing it by hand, take halfway between them. (MEDIAN does this for you.)
  • Thinking the median never moves. It resists a few extreme values, but if many values change, it changes too.
  • Mixing up median and mean in a report. Both are called "average" in everyday speech. Always say which one you used.

Say it back

  1. What is the median of a sorted list of 6 values?
  2. All the values in a list are positive, and the biggest one doubles. Which changes: the mean, the median, or both?
  3. Mean GDP per person is about three times the median. What does that tell you about the data?
Show the answers
  1. Halfway between the 3rd and 4th values: add them and divide by 2.
  2. The mean changes. The median stays the same (as long as there are at least 3 values): the biggest value is still last in order, so the middle does not move.
  3. A few economies have very high values that pull the mean up. Most economies are below the mean.

What is next

Amara's next question is about fruit names, which you cannot add up or put in order of size. Before you meet the tool for that, Lesson 4 shows how to tell what kind of data each column holds, because that decides which calculations are allowed.

Formulas in this lesson were checked on 2026-10-09 against the official Google Sheets and Microsoft Excel help pages, and every number was calculated by running the formulas in a spreadsheet program (LibreOffice Calc) and checked by a separate calculation. Menu steps are written for Google Sheets on the web and Excel for Microsoft 365.


Answers to Your turn, alone

Show the answers
  1. =MEDIAN(F2:F189) gives 74.65 years.
  2. =ROUND(AVERAGE(F2:F189), 1) gives 73.9 years. That is close to the median (less than one year apart).
  3. =MEDIAN(D32:D38) gives ₦38,500. No: it is higher than his mean, ₦31,914. One very bad day pulls Kofi's mean down.
  4. For example: "In 2024 the typical economy had a GDP per person of about $7,718 (the median). We used the median because a few very rich economies pull the mean up to $22,706, which is higher than 129 of the 188 economies."