MEDIAN
Returns the middle value of a numeric data set.
For an even number of values, MEDIAN returns the average of the two center values.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=MEDIAN(number1, [number2], ...)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number1 | number (range) | Required | — |
number2 | number (range) | Optional | — |
Accepts a variable number of arguments. Minimum: 1.
Remarks
- Ignores non-numeric values in referenced ranges.
- Supports both scalar arguments and range inputs.
Error cases
- Returns
#NUM!when no numeric values are available.
Examples
Find the middle value of 4, 8 and 12.
Formula =MEDIAN(4,8,12)
Expected result 8
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Pass one three-element array to compute the middle value.
Formula =MEDIAN({4,8,12})
Expected result 8
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
The single observation occupies the middle position.
Formula =MEDIAN(7)
Expected result 7
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A division error among 4 and 12 prevents computing the middle value.
Formula =MEDIAN(4,1/0,12)
Expected result #DIV/0!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Median of an odd-sized set
Formula =MEDIAN(1,3,8)
Expected result 3
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Median of an even-sized range
Formula =MEDIAN(A1:A4)
| A | |
|---|---|
| 1 | 1 |
| 2 | 2 |
| 3 | 10 |
| 4 | 12 |
Expected result 6
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
When does MEDIAN return #NUM!?
MEDIAN returns #NUM! when no numeric values are available after filtering/coercion.