Statistical function

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], ...)
ArgumentWhat it means
number1RequiredA number, reference or range.
number2, ...OptionalUp 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

D2fx=MEDIAN(B2:B6)
ABCD
1EmployeeSalary
2Ana3800041500
3Ben41500
4Chloe39200
5Dev45000
6Eva182000

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

D2fx=MEDIAN(B2:B5)
ABCD
1OrderValue
2#1120105
3#275
4#3310
5#490

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

D2fx=MEDIAN(B2:B6)
ABCD
1DayReturns
2Mon43
3Tue
4Wed0
5Thu7
6Fri2

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

D2fx=MEDIAN(IF(A2:A6="North", B2:B6))
ABCD
1RegionDeal size
2North12001200
3South800
4North4100
5North950
6South1500

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.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 18 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
DutchMEDIAAN
FinnishMEDIAANI
FrenchMEDIANE
HungarianMEDIÁN
ItalianMEDIANA
PolishMEDIANA
Portuguese (Brazil)MED
Portuguese (Portugal)MED
RussianМЕДИАНА
SpanishMEDIANA
TurkishORTANCA