### Median (fld), Median (fld, condFld), Median (fld, condFld, cond)

Basic and Crystal syntax.

##### Arguments

- fld is any valid database or formula field that can be evaluated by the function.
- condFld is a field used to group the values in fld by.
- cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.

##### Returns

Fractional Number

##### Action

Calculates the median of the given numeric fields. The median is the middle value in a sequence of numeric values (or the average of the two middle values in an even-numbered sequence of values).

For example:

- You can calculate the median of all the values in a field. For information on this kind of summary, see SummaryFunction (fld).
- You can calculate the median of all the values in the field, within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
- You can calculate the median of all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).

##### Examples

The following examples are applicable to both Basic and Crystal syntax:

`Median({Customer.LAST YEAR'S SALES})`

Returns $29087, where the values of the Last Year's Sales field are $27014, $28000, $29087, $34500, and $48260.

`Median({Customer.LAST YEAR'S SALES}, {Customer.REGION)`

Groups the Last Year's Sales field by region and returns the median of the Last Year's Sales field per region.

`Median({orders.ORDER AMOUNT}, {Customer.REGION}, "monthly")`

Groups values in the Amount field by region, then returns the median of the order amount for each region per month.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com