MEDIAN
- MEDIAN(*values)[source]
Computes the median of one or more numeric values or arrays.
This function calculates the median of the provided inputs. If array arguments are provided, their elements are aggregated to compute the median. If any input is blank or in an error state, the formula will evaluate to an error.
- Parameters:
*values (
Operand|int|float) –One or more numeric values or arrays to include in the median calculation.
Supported types:
INTEGER
DECIMAL
INTEGER_ARRAY
DECIMAL_ARRAY
- Return type:
- Returns:
A formula object representing the computed median. If all inputs are arrays, the result is a single aggregated numeric value.
Supported types:
DECIMAL
- Raises:
ValueError – If no inputs are provided.
ValueError – If any input is not a numeric type or array of numeric type.
Examples
Single values:
MEDIAN(1, 2, 5) # Returns 2.0
Array input:
MEDIAN([0, 2, 3], [4, 5, 8]) # Returns 3.5