# Documentation/Calc Functions/MEDIAN

Jump to navigation
Jump to search

TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate

## Function name:

MEDIAN

## Category:

Statistical Analysis

## Summary:

Finds the median of a set of numbers. In a set containing an odd number of values, the average of the two numbers in the middle of the set (as appropriate) but only after the function has sorted the values into numerical order and in a set containing an even number of values, it will be the mean of the two values in the middle of the set.

## Syntax:

MEDIAN(**Number 1** [; **Number 2** [; … [; **Number 255**]]])

## Returns:

Returns a real number which is the median value in the list of arguments.

## Arguments:

**Number 1**, **Number 2**, ..., **Number 255** are numbers, references to cells or to cell ranges of numbers which represent a sample.

- If any of the arguments contain text value either being passed directly then the function returns a name (#NAME?) error and when passed with double quotes an error value (Err:504) is returned.
- If a cell contains text, error value, or empty cells, then the function ignores these values. For logical values, TRUE is considered as 1 and FALSE as 0.
- If a cell has 0 then the function considers it.

## Additional details:

None

## Examples:

Formula | Description | Returns |
---|---|---|

=MEDIAN(1;5;9;20;21) | For an odd number of arguments, the median will be the number in the middle of the set. | 9 |

=MEDIAN(5;1;9;21;20) | For an odd number of arguments, the median will be the number in the middle of the set. In this case, the numbers are not sorted in ascending order so the function sorts the number first and then returns the median value. | 9 |

=MEDIAN(1;5;9;20) | For an even number of arguments, it will be the average of the two values in the middle of the set. | 7 |

## Related LibreOffice functions:

## ODF standard:

## Equivalent Excel functions:

MEDIAN