formulastreak

Statistics function

MEDIAN function in Google Sheets and Excel

MEDIAN returns the middle value of a set of numbers once they're sorted, a typical value that big outliers barely move.

Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet

Syntax

MEDIAN(number1, [number2], ...)

Arguments in [brackets] are optional. Google Sheets writes it MEDIAN(value1, [value2, ...]).

Example

=MEDIAN(D2:D13) reads: Sort the twelve exam scores in D2:D13 and return the middle value; with an even count, halfway between the 6th and 7th.

Exam results · edit J1 and watch it recalculate
Click a cell (or use the arrow keys) to insert its address · Enter shows the resultJ1 = 71
ABCDEFGHIJ
1StudentClassHoursScoreFromGradeMedian71
2NoorA2480F
3MateoB56650D
4HanaA88160C
5OllieB35570B
6ZaraA109385A
7IvanB672
8LeaA139
9OmarB777
10SaraA988
11TheoB461
12YukiA670
13BeaB884

J1 shows 71: the 6th and 7th of the twelve sorted scores are 70 and 72.

How the spreadsheet calculates it

Finds the middle value of D2:D13.

  1. 1. MEDIAN: Finds the middle value of D2:D13.
    • range = `D2:D13`: the numbers

More MEDIAN examples

  • =MEDIAN(C2:C13)The middle number of study hours.
  • =MEDIAN(FILTER(D2:D13,B2:B13="A"))Class A's median score.
  • =AVERAGE(D2:D13)-MEDIAN(D2:D13)How far the average sits from the median: a quick skew check.
  • =MEDIAN(D2:D7,D10:D13)The median of two separate ranges together.

Paste any of these into the formula explainer to see it step by step.

Tips

  • Report the median next to the average: a big gap between them tells you the data is skewed.
  • Keep blanks blank rather than typing 0 for missing values, since zeros are counted.
  • Use whole columns of numbers only, without totals underneath that would join the data.

What MEDIAN is used for

Reporting typical salaries, prices or response times where a few extreme values would distort the average, comparing groups fairly, and as the midpoint in box-plot style summaries with the quartiles.

Arguments

ArgumentRequiredWhat it is
number1YesA range or number, such as D2:D13.
number2, …NoMore ranges or numbers to include.

Common mistakes

  • Reporting the average of skewed data as “typical”.

  • Expecting it to skip zeros: Microsoft's page says cells holding 0 are included, while text, TRUE/FALSE and empty cells in a range are ignored.

  • Sorting the data by hand first: MEDIAN sorts internally, so the order in the sheet doesn't matter.

  • Comparing the median of one group with the average of another; compare like with like.

In Google Sheets

Google Sheets has MEDIAN with the same arguments (MEDIAN(value1, [value2, ...])).

Errors you may see with MEDIAN

  • #NUM!: There are no numbers in the range at all.
  • #VALUE!: A number typed directly into the formula as text that can't be read as a number.

Questions

When should I use MEDIAN instead of AVERAGE?

When a few very large or small values would drag the average away from what's typical: salaries, house prices, delivery times. If the median and average are close, the data is fairly balanced.

What does MEDIAN do with an even number of values?

It returns the average of the two middle values. In the example the 6th and 7th of the twelve sorted scores are 70 and 72, so the median is 71.

How do I get the median for one group only?

Filter first, then take the median: MEDIAN(FILTER(D2:D13, B2:B13="A")) gives class A's median score (needs a version with FILTER).

Is the median the same as the 50th percentile?

Yes: PERCENTILE.INC(range, 0.5) and QUARTILE.INC(range, 2) return the same value as MEDIAN. See the statistics functions guide.

Sources

Official documentation the facts on this page were checked against.

Practise MEDIAN on a live sheet

Lesson 43, Typical values and spread (Unit 13, Statistics), has 6 graded exercises, checked instantly, with steps and hints when you're stuck. Pro