MEDIAN function
Returns the middle value of a set of numbers, a typical value that, unlike the average, is not pulled by extreme outliers.
Available in All versions of Excel, including Microsoft 365 and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
MEDIAN(number1, [number2], ...)| Argument | What it means | |
|---|---|---|
number1 | Required | A number, reference or range. |
number2, ... | Optional | Up to 255 numbers, references or ranges. |
Returns: The middle number; with an even count, the average of the two middle numbers.
How MEDIAN works
Sort the numbers from smallest to largest and pick the one in the middle: that is the median. Half the values are at or below it and half at or above. It is the preferred "typical value" for anything skewed, such as salaries, house prices, delivery times or order values, because one huge number cannot drag it around the way it drags the AVERAGE.
With an odd number of values the median is the middle one; with an even number Excel averages the two middle values. Empty cells, text and logical values in ranges are ignored, but cells containing 0 are counted. For other cut points use PERCENTILE.INC or QUARTILE.INC: the median is the 50th percentile and the second quartile.
Examples
1Typical salary despite one outlier
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Employee | Salary | ||
| 2 | Ana | 38000 | 41500 | |
| 3 | Ben | 41500 | ||
| 4 | Chloe | 39200 | ||
| 5 | Dev | 45000 | ||
| 6 | Eva | 182000 |
Result: 41500
Sorted: 38,000, 39,200, 41,500, 45,000, 182,000. The middle value is 41,500. The average is 69,140, inflated by the director's salary, so the median describes the typical employee much better.
2Even number of values
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order | Value | ||
| 2 | #1 | 120 | 105 | |
| 3 | #2 | 75 | ||
| 4 | #3 | 310 | ||
| 5 | #4 | 90 |
Result: 105
Sorted: 75, 90, 120, 310. With four values there is no single middle, so Excel averages 90 and 120 = 105.
3Blanks are ignored, zeros are not
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Day | Returns | ||
| 2 | Mon | 4 | 3 | |
| 3 | Tue | |||
| 4 | Wed | 0 | ||
| 5 | Thu | 7 | ||
| 6 | Fri | 2 |
Result: 3
Tuesday's empty cell is skipped, Wednesday's 0 counts. The values 0, 2, 4, 7 give a median of (2 + 4) / 2 = 3. If no data should be a blank rather than 0, leave the cell empty.
4Median for one group
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Region | Deal size | ||
| 2 | North | 1200 | 1200 | |
| 3 | South | 800 | ||
| 4 | North | 4100 | ||
| 5 | North | 950 | ||
| 6 | South | 1500 |
Result: 1200
There is no MEDIANIFS, so IF keeps only North deals (1,200, 4,100, 950) and MEDIAN returns 1,200. In Microsoft 365 it works as typed; in older versions press Ctrl+Shift+Enter. =MEDIAN(FILTER(B2:B6, A2:A6="North")) also works in 365.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NUM! | There are no numbers in the arguments. | Check that the range holds real numbers, not text. |
#N/A (or another error) | A cell in the range contains an error value. | Fix the error, or use =AGGREGATE(12,6,range) to ignore errors. |
Tips
- Report median and average together: a big gap between them is a quick sign of skewed data.
=AGGREGATE(12, 5, range)calculates the median while ignoring hidden rows, handy with filters.- Medians cannot be averaged across groups; recompute from the raw data.
Questions
When should I use median instead of average?
When the data is skewed or has outliers, such as salaries, prices, response times. If the data is symmetric, the two are almost the same.
Is there a MEDIANIFS function?
No. Use =MEDIAN(IF(condition, values)) or, in Microsoft 365, =MEDIAN(FILTER(values, condition)).
Why does MEDIAN ignore my numbers?
They are probably stored as text. Text in a range is skipped; convert it to numbers first.
Google Sheets
MEDIAN also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
MEDIAN in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Dutch | MEDIAAN |
| Finnish | MEDIAANI |
| French | MEDIANE |
| Hungarian | MEDIÁN |
| Italian | MEDIANA |
| Polish | MEDIANA |
| Portuguese (Brazil) | MED |
| Portuguese (Portugal) | MED |
| Russian | МЕДИАНА |
| Spanish | MEDIANA |
| Turkish | ORTANCA |