For numerical data ranked in ascending order, the quartiles are values derived from the data which divide the data into four equal parts. If there are n observations, the first quartile (or lower quartile) Q1 is the -th, the second quartile (which is the median) Q2 is the -th, and the third quartile (or upper quartile) Q3 is the -th in ascending order. When is not a whole number, it is sometimes thought necessary to take the (weighted) average of two observations, as is done for the median. However, unless n is very small, an observation that is nearest will normally suffice. For example, for the sample 15, 37, 43, 47, 54, 55, 57, 64, 76, 98, we may take Q1=43, Q2=54.5, and Q3=64.
For a random variable, the quartiles are the quantiles x0.25, x0.5, and x0.75; that is, the 25th, 50th, and 75th percentiles.