How to find the median
Sort the dataset from smallest to largest. If the count is odd, the median is the middle value. If the count is even, the median is the average of the two middle values.
For example, the dataset 3, 7, 8, 12, 15 has five values — the middle value is 8, so the median is 8. For 3, 7, 8, 12, the two middle values are 7 and 8, so the median is (7 + 8) / 2 = 7.5.
Odd n: median = value at position (n + 1) / 2
In a sorted dataset with an odd count, the median is the value at the exact midpoint.
Even n: median = (value at n/2 + value at n/2 + 1) / 2
In a sorted dataset with an even count, the median is the average of the two middle values.