median

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
median(<numbersList>)
Summary

Returns the median (middle number) of a list of numbers.

Introduced1.1
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
numbersList

A comma-separated list of numbers, or an expression that evaluates to such a list, or an array containing only numbers.

Example
median(6,22,8) -- returns 8
put median(incomeLevels) into field "2001 Median Income"
Values
NameTypeDescription
return

The median function returns a number.

RelatedControl Structure: function
Glossary: return, value, math operation
Function: average, standardDeviation, value
Description

Use the median function to find the value that best represents a group of values.

If the number of items in the numbersList is odd, the median function returns the middle value of the list when it is sorted in numeric order. If the number of items is even, the median function takes the two middle values and averages them to produce the median.

If the list consists of fewer than three numbers, or if the numbers are evenly distributed, the median is equal to the average.

If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.

Tagsmath