# MEDIAN

The following section describes the syntax and usage of the MEDIAN function in ActivityInfo.

## Description

The MEDIAN function is used to find the median value from a set of values. The function returns the "middle" value from a set a values.

## Syntax

MEDIAN(val1, val2, val3, ...)

+-----------------------+-----------------------+-----------------------+ | Argument | Required | Description | +=======================+=======================+=======================+ | val1 | Yes | A numeric value. | +-----------------------+-----------------------+-----------------------+ | val2 | Yes | Another numeric | | | | value. | +-----------------------+-----------------------+-----------------------+ | val3 | Yes | Another numeric | | | | value. | +-----------------------+-----------------------+-----------------------+ | ... | No | Any further numeric | | | | values. | | | | | | | | If an argument is | | | | missing, NA, or | | | | non-numeric, it will | | | | be excluded from the | | | | calculation. | +-----------------------+-----------------------+-----------------------+

## Result

The median value from the set of input arguments.

• If there are an odd number of values, the function returns the value which separates the lower and higher halves of the input set.
• If there are an even number of values, the function returns the average of the middle two values in the input set.

By Blythwood - Own work, CC BY-SA 4.0, Link

## Example

We will be using the MEDIAN function to calculate the middle row value from a set of three columns.

### Arguments

We will be using three Quantity fields:

• "Value 1" (with code "val1")
• "Value 2" (with code "val2")
• "Value 3" (with code "val3")

### Formula

MEDIAN(val1,val2,val3)