It has been suggested that this page's contents be merged with the page Finding the Mean of Numbers. You can discuss this on the page's talk page. (July 2021)

The median of a set of five numbers.
This article is about finding the median (middle number) of a set of numbers. For the mean (better known as the average), see Finding the Mean of Numbers. For the mode (most frequently occurring number), see Finding the Mode of Numbers.

The median of a set of numbers is the middle value. If the set of numbers has an even amount, the median is the average of the two middle numbers.

## Finding the Median

### Sorting the Values

Main article: Sorting Values

The first step in finding the median is to sort the data from least to greatest. Doing this first will make this finding the median much easier.

### The Script

Then, use the following script to get the median. Remember that the list "Data" contains the set of values. The variables "Med1" and "Med2" represent the values that will be used to solve for the median.

```set [Med1 v] to (item ((length of [data v]) / (2)) of [data v])
set [Med2 v] to (item (((length of [data v]) / (2)) + (1)) of [data v])
if < ((length of [data v]) mod (2)) = (0)> then
say (join [median=] (((Med1) + (Med2)) / (2))) for (2) secs
else
say (join [median=] (item (((length of [data v]) / (2)) + (0.5)) of [data v])) for (2) secs
end
```