Example 1
Median with an odd count
B10 =MEDIAN(B2:B8)
Result: 38,000
Seven values: the fourth, 38,000, is in the middle.
B10 =MEDIAN(B2:B8) returns 38,000
Returns the middle value of a set of numbers. It is less affected by outliers than the average.
Syntax
=MEDIAN(, [number2], ...)
All versions of Excel, including Excel for Microsoft 365 and Excel for the web.
Try it
Edit the formula in B10 or change the inputs. The sheet recalculates as you type.
B10 =MEDIAN(B2:B8) returns 38,000
MEDIAN returns the value in the middle once the numbers are sorted. Half the values are below it and half are above. It is the better "typical value" when a few extremes would distort the average: salaries, house prices, response times and order sizes are all lopsided in this way.
Excel sorts the numbers internally, then:
You do not need to sort the data first.
In a range or cell reference MEDIAN skips text, blank cells and TRUE/FALSE. Zeros are included. Numbers and logical values typed straight into the formula are counted. If there are no numbers, MEDIAN returns #NUM!. An error value in the data makes the result an error.
Take salaries of 31,000, 34,500, 36,200, 38,000, 41,000, 47,500 and 120,000. The average is about 49,743, higher than six of the seven people earn, because one very high salary pulls it up. The median is 38,000, which is much closer to what most people are paid. When the two figures are far apart, the data is skewed, and quoting only the AVERAGE would be misleading.
MEDIAN has no built-in condition, unlike AVERAGEIF. To find the median for one group, filter the values first:
=MEDIAN(IF(A2:A9="Ops", B2:B9))
In Microsoft 365 this works as typed. In Excel 2019 and earlier, confirm it with Ctrl+Shift+Enter. Another route in Microsoft 365 is =MEDIAN(FILTER(B2:B9, A2:A9="Ops")). The IF version works because MEDIAN ignores the FALSE values that IF returns for non-matching rows.
MODE.SNGL returns the most frequent value. PERCENTILE.INC with 0.5 gives the same answer as MEDIAN, and with other fractions finds other cut points. QUARTILE.INC uses 1, 2 or 3 to find the quartiles; quartile 2 is the median.
SUBTOTAL and AGGREGATE can also calculate a median, in AGGREGATE's case (function 12) while ignoring errors or hidden rows.
B2:B8.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
B10 =MEDIAN(B2:B8)
Result: 38,000
Seven values: the fourth, 38,000, is in the middle.
B10 =MEDIAN(B2:B8) returns 38,000
Example 2
B7 =MEDIAN(B2:B5)
Result: 13.5
Sorted, the values are 9, 12, 15, 20. The middle two are 12 and 15, which average 13.5.
B7 =MEDIAN(B2:B5) returns 13.5
Example 3
B10 =ROUND(AVERAGE(B2:B8),0)
Result: 49,743
The average, 49,743, sits well above the median of 38,000 because of the single 120,000 salary.
B10 =ROUND(AVERAGE(B2:B8),0) returns 49,743
Example 4
B9 =MEDIAN(IF(A2:A7="Ops",B2:B7))
Result: 34,500
IF passes only the Ops salaries (31,000, 36,200 and 34,500) to MEDIAN, which ignores the FALSE results. The middle value is 34,500. In Excel 2019 and earlier, confirm with Ctrl+Shift+Enter.
B9 =MEDIAN(IF(A2:A7="Ops",B2:B7)) returns 34,500
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B9, return the median time to pick an order.
Answer in B9.
#NUM!.MEDIAN(IF(...)) or MEDIAN(FILTER(...)) for a group, and remember that older versions need Ctrl+Shift+Enter.The mean (AVERAGE) adds the values and divides by the count. The median is the middle value after sorting. Extreme values move the mean a lot and the median very little.
It ignores blanks and text. Zeros are numbers, so they are included.
Use `=MEDIAN(IF(A2:A9="Ops",B2:B9))`, which works as typed in Microsoft 365 and needs Ctrl+Shift+Enter in older versions. `=MEDIAN(FILTER(B2:B9,A2:A9="Ops"))` is another option in Microsoft 365.
Yes. `=PERCENTILE.INC(B2:B8,0.5)` and `=QUARTILE.INC(B2:B8,2)` give the same answer as `=MEDIAN(B2:B8)`.
MEDIAN is taught in Data analysis with formulas, lesson 16: MEDIAN, PERCENTILE and QUARTILE. Each lesson is a short, graded exercise like the one above.