Besides mean, the median is a widely used measure of central tendency. Typically, median is defined as the central or middle value of a data set, measured by arranging the data elements in an increasing or decreasing order. Since this middle value is not affected by the precise numerical values of the outliers or fluctuations, it is insensitive to them. Hence, in cases where a data set may have outliers or the extreme values are not known, the median is a better measure of the central tendency than the mean.
The median may be the exact middle value of a data set, if the number of elements it contains is odd. If it is even, the median is equal to the average of the two middle values, but is not equal to either of the two values.
Calculating the median requires sorting the data set and calculating the number of elements it contains. Hence, there is no simple algebraic formula. However, standard softwares can easily compute the median of a data set.