# Quartile Calculator

Welcome to the **quartile calculator**, where we'll learn **how to calculate quartiles of a dataset**. In fact, whenever we have a collection of numbers that we want to understand better using statistics, finding the quartiles is one of **the first things that comes to mind**. Therefore, we will study the topic slowly and in depth.

We'll begin with the **quartile definition**, and then jump straight to the problem of **how to find Q1 and Q3**, where Q1 denotes **the first quartile** (sometimes called **the lower quartile**), and Q3 is **the third quartile** (or **upper quartile**, if you please).

So sit back, grab a sandwich for the journey, and **let's get to it**!

## What is a quartile?

Usually, when you have a dataset and you want to look at all the values collectively, **statistics comes to the rescue**. There are a few functions where a single number can provide you with **information about all the entries**.

For instance, suppose that you're applying to college and would like to know **how your entry exam looks in comparison to all the others**. The simplest and most well-known statistical function that could help with that is **mean**. It returns the average of all the entries, so you can see if, in general, you're **below or above average**.

But does that mean that you're respectively worse or better than half of the applicants? **Not so much**. In fact, if the data is very scattered, i.e., if the smallest numbers are far from the largest ones, **the average may give you the wrong picture** of the values as a whole. And that's why **it's useful to learn how to calculate quartiles**. So, what is a quartile?

## The quartile definition

**The first quartile** and **the third quartile** (denoted by Q1 and Q3 respectively) are numbers that mark the borders of **the middle half of the entries**. In other words, they are the medians (middle values) of the first and the second half of the dataset. To be more precise, a quarter (that's where the name comes from) of all the entries **are smaller than the lower quartile**, and a quarter of all the numbers **are larger than the upper quartile**.

Coming back to college applications, suppose that **the average score** among the, say, one hundred applicants is `56%`

. It would suggest that more than fifty are above `50%`

. However, if there are a few large scores, **this may not be the case**.

Once we get to finding quartiles, it might turn out, for example, that the first quartile is `33%`

, and the third quartile is `48%`

. This means that **only a quarter of all applicants are above** `48%`

- a very different picture than what we got from the mean. Now, if your score is `52%`

, then your percentage **looks much better with quartiles in mind**, doesn't it?

In addition, just to give you a point of reference, **quartiles are closely connected to other statistical notions**. For instance, the lower quartile is the 25th percentile, while the upper quartile is the 75th percentile of the dataset.

What is more, the range between one and the other marks, as we mentioned above, **where the middle half of the entries lies**. As you might have guessed, it proves quite useful in data analysis. So useful, in fact, that it got its own name - the interquartile range.

Among other things, the interquartile range is fundamental in detecting outliers with the upper and lower fences.

Lastly, let us mention that the quartiles are two of the values in the so-called five number summary. The other three are **the minimum**, **median**, and **maximum**. Together they give such a good description of your dataset that we've decided to **add them to the quartile calculator in its advanced mode**. Observe that there's no mention here of the average we're so accustomed to. It seems like the big-headed statisticians got rid of it

**in favor of more accurate functions**. In essence, quartile is a statistical measure to divide the data into ranks, just like percentile and decile.

Now that we have answered "*What is a quartile?*", why don't we get into the specifics of **how to find Q1 and Q3**? After all, the theory is all fine, but **actual calculations are the real deal**!

## Lower and upper quartiles - how to find Q1 and Q3?

The first step when finding quartiles is to **determine where the median of your dataset is**. Remember that, although it marks the middle of the entries, it is very different from mean. To be honest, we don't really need its value when finding quartiles, **just its position**, but the definition and formula will prove useful soon enough.

Suppose that your dataset is

`a₁`

, `a₂`

, `a₃`

,..., `aₙ`

and assume that **it is sorted from smallest to largest**. If it weren't, we'd have to order the numbers before moving on.

If `n`

is odd, then median is simply **the entry in the middle**. For instance, if `n = 7`

, then it is equal to `a₄`

(because it has three values both before it and after it).

If, however, `n`

is even, then **there is no single middle entry**. In that case, we have to take two the two central values and **calculate their arithmetic mean**. For example, if `n = 8`

, then the median is the average of `a₄`

and `a₅`

, which is `(a₄ + a₅) / 2`

.

Now that we have the middle value, we can look into **how to find Q1 and Q3**. In fact, we follow a similar pattern since, as we've said in the previous section, **the lower quartile is the median of the first half of the dataset, and the upper quartile is that of the second** (in other words, of the entries between the minimal one and the median, and between the median and the maximal one, respectively).

On the one hand, when `n`

is odd, say, `n = 7`

, then the middle value (the median) **marks the end of the first and the beginning of the second half of the entries**. Therefore, the lower quartile will be the median of `a₁`

, `a₂`

, `a₃`

, `a₄`

, while the upper one will be that of `a₄`

, `a₅`

, `a₆`

, `a₇`

(a keen eye will note that `a₄`

appears both times).

On the other hand, when `n`

is even, then we don't take the actual median, but rather **the entries that we took to calculate it**. What we mean by that is that if, for instance, `n = 8`

, then the median is the mean `(a₄ + a₅) / 2`

. The first quartile is then the median of `a₁`

, `a₂`

, `a₃`

, `a₄`

and the third quartile is that of `a₅`

, `a₆`

, `a₇`

, `a₈`

. Note that **the value** `(a₄ + a₅) / 2`

**appears in neither of them** (this is what we meant by we don't really need the median value to find Q1 and Q3).

Phew, that was quite a lot of time spent on theory, wouldn't you say? But now that we're familiar with the quartile definition and know how to calculate quartiles, we're ready to see **an example that actually has numbers in it**.

**Ready?**

## Example: using the quartile calculator

Say that you're a high school teacher and you just **finished marking a recent test**. It was out of `50`

points and the results are:

`32`

, `21`

, `38`

, `12`

, `44`

, `42`

, `37`

, `36`

, `21`

, `9`

, `40`

, `33`

, `22`

, `25`

, `27`

, `29`

, `30`

, `48`

, `19`

, `17`

, `30`

, `22`

, `45`

, `42`

.

Just looking at this sequence of numbers, you can't really tell if it went well or not. Fortunately, statistics come to the rescue! With **the quartile calculator**, and our knowledge of how to find Q1 and Q3, we can understand our data so much better.

Looking at the quartile calculator, we see **windows #1 to #8, into which we can input data**. However, once we start putting the numbers in one after the other, **more windows will appear**, allowing us to enter up to thirty entries. Also, even though finding quartiles requires an ordered dataset, you don't have to do it yourself - **the calculator will do this menial work for you**!

Note, that while we're inputting the data, the quartile calculator **will show us the answer of every entry entered so far entries**. Observe how the result changes with every value. Once you're done with the last one, **you can check the answer below**, and if you'd like some more information about your dataset, be sure to **check out the advanced mode**!

But let's not spoil it for ourselves and see how to **calculate the quartiles ourselves**. So, grab a piece of paper and **let's get to it**!

## Finding quartiles manually

First of all, we have to put in some overtime and **order the entries from smallest to largest**. This means that instead of the sequence above, we'll be working with:

`9`

, `12`

, `17`

, `19`

, `21`

, `21`

, `22`

, `22`

, `25`

, `27`

, `29`

, `30`

, `30`

, `32`

, `33`

, `36`

, `37`

, `38`

, `40`

, `42`

, `42`

, `44`

, `45`

, `48`

.

Now recall from the previous section that the next step is to **find the median**. Since we have `24`

test results (which is an even number), we'll have to **find the arithmetic mean of the two middle values** - the **12th** and the **13th**. In our case, they are `30`

and `30`

, which makes the calculations a piece of cake:

`median = (30 + 30) / 2 = 30`

.

Now we move on to how to find Q1 and Q3. For **the first quartile**, we find the median of the first `12`

numbers (again, an even number), so it will be the mean of the **6th** and the **7th**. In our case, they are `21`

and `22`

, which gives

`Q1 = (21 + 22) / 2 = 21.5`

.

Similarly, **the third quartile** is the average of the **18th** and the **19th** entry, which are `38`

and `40`

. This results in

`Q3 = (38 + 40) / 2 = 39`

.

Alright, **we have our results**! Now let's try to interpret them.

The lower quartile is `21.5`

, so only **a quarter of the class got a score below that**. Not too bad, is it? There's always a group that underestimates the subject and doesn't spend enough time studying.

Then, on the other side, we have the upper quartile of `39`

. This means that `25%`

**of people got more than that**. Now that is a good score, congratulations to them!

In general, **most of the results were above half of the maximal number of points**. Still, it's good to take all this into account **when you prepare the next test**. Good thing there's only one more, and then the school year's over!