Investment Studio > Expressions > Functions > Statistical > MEDIAN
float median(float data [, ...])
Returns the median of the data list.
All elements in the list are converted to floats, with exclusion if conversion fails. The list may contain array arguments, in which case each array element is treated as a separate list element.
If the number of elements in the list is odd, the median is the middle element of the list, sorted by size. If the number of elements in the list is even, the median is the arithmetic average of the two elements in the middle of the list, sorted by size.
Examples
=median(3, 1, 2)
returns 2 (the middle element of the list, sorted by size);
=median(3, 1, 4, 2)
returns 2.5 (the arithmetic average of the two middle elements of the list, sorted by size).
Assuming standard US date format settings,
=median(1, "1/1/2001", "Hello, world!", 10)
returns 10 (the middle value of the list, sorted by size and including the value of the date "1/1/2001", 36892);
=median(1, "1/1/2001", "Hello, world!", "1E6")
returns 36892 (the value of the date "1/1/2001", 36892);
=median("Hello", "world!")
is an error (no valid values).