How to Find Interquartile Range (IQR) | Calculator & Examples

In descriptive statistics, the interquartile range tells you the spread of the middle half of your distribution.

Quartiles segment any distribution that’s ordered from low to high into four equal parts. The interquartile range (IQR) contains the second and third quartiles, or the middle half of your data set.

Comparing the inclusive and exclusive IQR on a boxplot

Whereas the range gives you the spread of the whole data set, the interquartile range gives you the range of the middle half of a data set.

Interquartile range calculator

You can calculate the interquartile range by hand or with the help of our interquartile range calculator below.

Calculate the interquartile range by hand

The interquartile range is found by subtracting the Q1 value from the Q3 value:

Formula Explanation
Interquartile range formula
  • IQR = interquartile range
  • Q3 = 3rd quartile or 75th percentile
  • Q1 = 1st quartile or 25th percentile

Q1 is the value below which 25 percent of the distribution lies, while Q3 is the value below which 75 percent of the distribution lies.

You can think of Q1 as the median of the first half and Q3 as the median of the second half of the distribution.

Methods for finding the interquartile range

Although there’s only one formula, there are various different methods for identifying the quartiles. You’ll get a different value for the interquartile range depending on the method you use.

Here, we’ll discuss two of the most commonly used methods. These methods differ based on how they use the median.

Exclusive method vs inclusive method

The exclusive method excludes the median when identifying Q1 and Q3, while the inclusive method includes the median in identifying the quartiles.

The procedure for finding the median is different depending on whether your data set is odd- or even-numbered.

  • When you have an odd number of data points, the median is the value in the middle of your data set. You can choose between the inclusive and exclusive method.
  • With an even number of data points, there are two values in the middle, so the median is their mean. It’s more common to use the exclusive method in this case.

While there is little consensus on the best method for finding the interquartile range, the exclusive interquartile range is always larger than the inclusive interquartile range.

The exclusive interquartile range may be more appropriate for large samples, while for small samples, the inclusive interquartile range may be more representative because it’s a narrower range.

Steps for the exclusive method

To see how the exclusive method works by hand, we’ll use two examples: one with an even number of data points, and one with an odd number.

Even-numbered data set

We’ll walk through four steps using a sample data set with 10 values.

Step 1: Order your values from low to high.
Ordered data set (even number)
Step 2: Locate the median, and then separate the values below it from the values above it.
With an even-numbered data set, the median is the mean of the two values in the middle, so you simply divide your data set into two halves.Data set in two halves
Step 3: Find Q1 and Q3.
Q1 is the median of the first half and Q3 is the median of the second half. Since each of these halves have an odd number of values, there is only one value in the middle of each half.

Finding Q1 and Q3

Step 4: Calculate the interquartile range.
Calculating the IQR

Odd-numbered data set

This time we’ll use a data set with 11 values.

Step 1: Order your values from low to high.
Ordered data set (odd number)
Step 2: Locate the median, and then separate the values below it from the values above it.
In an odd-numbered data set, the median is the number in the middle of the list. The median itself is excluded from both halves: one half contains all values below the median, and the other contains all the values above it.

Finding the median and dividing the data set into two halves

Step 3: Find Q1 and Q3.
Q1 is the median of the first half and Q3 is the median of the second half. Since each of these halves have an odd-numbered size, there is only one value in the middle of each half.

Finding Q1 and Q3 in an odd-numbered data set

Step 4: Calculate the interquartile range.
Calculating the IQR

Steps for the inclusive method

Almost all of the steps for the inclusive and exclusive method are identical. The difference is in how the data set is separated into two halves.

The inclusive method is sometimes preferred for odd-numbered data sets because it doesn’t ignore the median, a real value in this type of data set.

Step 1: Order your values from low to high.
Ordered data set (odd number)
Step 2: Find the median.
The median is the number in the middle of the data set.

Median of an odd-numbered data set

Step 2: Separate the list into two halves, and include the median in both halves.
The median is included as the highest value in the first half and the lowest value in the second half.

Data set in two halves (inclusive method)

Step 3: Find Q1 and Q3.
Q1 is the median of the first half and Q3 is the median of the second half. Since the two halves each contain an even number of values, Q1 and Q3 are calculated as the means of the middle values.

Finding Q1 and Q3 in the inclusive method

Step 4: Calculate the interquartile range.
Calculating the IQR (inclusive method)

We can see from these examples that using the inclusive method gives us a smaller IQR. With the same data set, the exclusive IQR is 24, and the inclusive IQR is 20.

When is the interquartile range useful?

The interquartile range is an especially useful measure of variability for skewed distributions.

For these distributions, the median is the best measure of central tendency because it’s the value exactly in the middle when all values are ordered from low to high.

Along with the median, the IQR can give you an overview of where most of your values lie and how clustered they are.

The IQR is also useful for datasets with outliers. Because it’s based on the middle half of the distribution, it’s less influenced by extreme values.

Visualise the interquartile range in boxplots

A boxplot, or a box-and-whisker plot, summarises a data set visually using a five-number summary.

Every distribution can be organised using these five numbers:

  • Lowest value
  • Q1: 25th percentile
  • Median
  • Q3: 75th percentile
  • Highest value (Q4)

The vertical lines in the box show Q1, the median, and Q3, while the whiskers at the ends show the highest and lowest values.

Visualizing the IQR with a boxplot

In a boxplot, the width of the box shows you the interquartile range. A smaller width means you have less dispersion, while a larger width means you have more dispersion.

An inclusive interquartile range will have a smaller width than an exclusive interquartile range.

Comparing the inclusive and exclusive IQR on a boxplot

Boxplots are especially useful for showing the central tendency and dispersion of skewed distributions.

The placement of the box tells you the direction of the skew. A box that’s much closer to the right side means you have a negatively skewed distribution, and a box closer to the left side tells you that you have a positively skewed distribution.

IQR with skewed distributions

Frequently asked questions

What are the 4 main measures of variability?

Variability is most commonly measured with the following descriptive statistics:

What’s the difference between the range and interquartile range?

While the range gives you the spread of the whole data set, the interquartile range gives you the spread of the middle half of a data set.

When should I use the interquartile range?

The interquartile range is the best measure of variability for skewed distributions or data sets with outliers. Because it’s based on values that come from the middle half of the distribution, it’s unlikely to be influenced by outliers.

What are the two main methods for calculating interquartile range?

The two most common methods for calculating interquartile range are the exclusive and inclusive methods.

The exclusive method excludes the median when identifying Q1 and Q3, while the inclusive method includes the median as a value in the data set in identifying the quartiles.

For each of these methods, you’ll need different procedures for finding the median, Q1 and Q3 depending on whether your sample size is even- or odd-numbered. The exclusive method works best for even-numbered sample sizes, while the inclusive method is often used with odd-numbered sample sizes.

Cite this Scribbr article

If you want to cite this source, you can copy and paste the citation or click the ‘Cite this Scribbr article’ button to automatically add the citation to our free Reference Generator.

Bhandari, P. (2023, January 19). How to Find Interquartile Range (IQR) | Calculator & Examples. Scribbr. Retrieved 3 December 2024, from https://www.scribbr.co.uk/stats/interquartile-range-meaning/

Is this article helpful?
Pritha Bhandari

Pritha has an academic background in English, psychology and cognitive neuroscience. As an interdisciplinary researcher, she enjoys writing articles explaining tricky research concepts for students and academics.