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.

Return type:

Formula

Returns:

A formula object representing the computed median. If all inputs are arrays, the result is a single aggregated numeric value.

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

``value`` (variadic) — accepted types

  • DECIMAL

  • DECIMAL_ARRAY

  • INTEGER

  • INTEGER_ARRAY

Return types

  • DECIMAL