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
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
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.
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Student | Class | Hours | Score | From | Grade | Median | 71 | ||
| 2 | Noor | A | 2 | 48 | 0 | F | ||||
| 3 | Mateo | B | 5 | 66 | 50 | D | ||||
| 4 | Hana | A | 8 | 81 | 60 | C | ||||
| 5 | Ollie | B | 3 | 55 | 70 | B | ||||
| 6 | Zara | A | 10 | 93 | 85 | A | ||||
| 7 | Ivan | B | 6 | 72 | ||||||
| 8 | Lea | A | 1 | 39 | ||||||
| 9 | Omar | B | 7 | 77 | ||||||
| 10 | Sara | A | 9 | 88 | ||||||
| 11 | Theo | B | 4 | 61 | ||||||
| 12 | Yuki | A | 6 | 70 | ||||||
| 13 | Bea | B | 8 | 84 |
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. 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
| Argument | Required | What it is |
|---|---|---|
| number1 | Yes | A range or number, such as D2:D13. |
| number2, … | No | More 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
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.