# Range and Interquartile Range: How to Find IQR

The range is the largest value in a dataset minus the smallest value. The interquartile range (IQR) is the third quartile minus the first quartile, which is the spread of the middle 50 percent of the data.

Those two sentences are the whole foundation. Everything else in this guide is about doing the arithmetic correctly, understanding why the two numbers behave so differently, and knowing which one to report when you describe a dataset.

## Why spread matters as much as the average

A mean or median tells you where the center of a dataset sits. It says nothing about how tightly the values cluster around that center. Two experiments can produce the same mean and completely different stories. A drug that lowers blood pressure by 10 mmHg in every participant is a different drug from one that drops it 30 mmHg in half the group and raises it 10 mmHg in the other half, even though the averages match.

Spread statistics are how researchers describe that variability. In biomedical work this is not a cosmetic detail. Immunogenicity assays, for example, depend on cut points that separate true positive signals from background noise, and the variability of the assay directly affects how many samples are misclassified [1]. When you read a methods section that reports a median with an interquartile range, the author is telling you two things at once: where the typical value sits and how much the middle half of the data wanders.

Range and IQR are the two simplest spread measures you can compute by hand. They answer different questions, and confusing them is one of the most common errors in student lab reports.

## Range and IQR at a glance

| Feature | Range | Interquartile Range (IQR) |
|--|--|--|
| Formula | maximum minus minimum | Q3 minus Q1 |
| What it measures | total spread, end to end | spread of the middle 50 percent |
| Uses every value? | Only the two extreme values | Only values at the 25th and 75th percentiles |
| Sensitivity to outliers | Very high | Low (robust) |
| Typical use | Quick scan of a small dataset | Describing skewed or outlier-prone data |
| Units | Same as the data | Same as the data |
| Pairs with | Minimum and maximum | Median, in a five-number summary |

The five-number summary is worth naming here because it ties the two concepts together. It consists of the minimum, Q1, the median (Q2), Q3, and the maximum. The range is the distance from the first number to the last. The IQR is the distance from Q1 to Q3. A boxplot draws exactly these five values.

## What is the interquartile range?

Quartiles split an ordered dataset into four groups of roughly equal size. Q1, the first quartile, is the value below which about 25 percent of the data fall. Q2 is the median, the 50 percent mark. Q3 is the 75 percent mark. The IQR is Q3 minus Q1.

Because the IQR ignores everything below Q1 and everything above Q3, extreme values cannot inflate it. A single contaminated sample reading of 900 mg/dL in a dataset where everything else sits between 80 and 120 will blow up the range but barely touch the IQR. That property is called robustness, and it is the main reason the IQR appears so often in clinical and laboratory reporting.

The IQR also underpins a standard rule for flagging outliers. Tukey's boxplot method marks any value more than 1.5 times the IQR below Q1 or above Q3 as a suspected outlier. This rule is descriptive, not a formal hypothesis test, and it is known to be conservative in some assay settings, where it can flag too many values as outliers and distort downstream cut point calculations [1]. Even so, it remains the default convention in most statistical software and in the boxplots you see in journals.

## How to find the interquartile range: the exact steps

Follow these steps in order. Do not skip the sorting step, because every quartile position depends on rank order, not on the original sequence of measurements.

1. Order the data from smallest to largest.
2. Find the median (Q2). If the count of values n is odd, the median is the middle value. If n is even, the median is the average of the two middle values.
3. Split the ordered data into a lower half and an upper half at the median.
4. Find Q1, the median of the lower half.
5. Find Q3, the median of the upper half.
6. Subtract: IQR = Q3 minus Q1.

Steps 3 through 5 hide a decision that changes your answer. When n is odd, the median is an actual data point. Do you include that point in both halves, or exclude it from both? Both conventions exist.

### Exclusive versus inclusive methods

The exclusive method (also called Method 1, or the Moore and McCabe approach) removes the median from both halves when n is odd. The lower half contains only values below the median, and the upper half contains only values above it.

The inclusive method (Method 2, or the Tukey approach) keeps the median in both halves.

For even n, the two methods agree, because the median falls between two values and belongs to neither half. For odd n, they can produce different quartiles and therefore a different IQR. Neither method is wrong. The problem is mixing them or failing to say which one you used.

This guide uses the exclusive method for the worked example below. State your method whenever you report quartiles by hand, and check which convention your software uses before comparing your numbers to a printout.

## Worked example with 12 values

Suppose a teaching lab measures resting heart rate in beats per minute for 12 volunteers and records the following values in the order the participants were tested:

78, 62, 91, 70, 85, 66, 74, 88, 69, 95, 72, 80

### Step 1: Order the data

Sorted smallest to largest:

62, 66, 69, 70, 72, 74, 78, 80, 85, 88, 91, 95

Here n = 12, which is even, so the exclusive and inclusive methods will give the same quartiles. That makes this a clean first example. The odd-n case is handled in the next section.

### Step 2: Find the median (Q2)

With n = 12, the two middle values are the 6th and 7th in the sorted list: 74 and 78.

Q2 = (74 + 78) / 2 = 76 beats per minute.

### Step 3: Split the data

The lower half is the first six values: 62, 66, 69, 70, 72, 74.

The upper half is the last six values: 78, 80, 85, 88, 91, 95.

### Step 4: Find Q1

The lower half has six values, so its median is the average of the 3rd and 4th: 69 and 70.

Q1 = (69 + 70) / 2 = 69.5 beats per minute.

### Step 5: Find Q3

The upper half also has six values. Its median is the average of the 3rd and 4th of that half: 85 and 88.

Q3 = (85 + 88) / 2 = 86.5 beats per minute.

### Step 6: Compute the IQR

IQR = Q3 minus Q1 = 86.5 minus 69.5 = 17 beats per minute.

The middle 50 percent of heart rates in this sample span 17 beats per minute.

### The same data as a sorted table

| Position | Value (bpm) | Half | Quartile role |
|--|--|--|--|
| 1 | 62 | Lower | |
| 2 | 66 | Lower | |
| 3 | 69 | Lower | Q1 component |
| 4 | 70 | Lower | Q1 component |
| 5 | 72 | Lower | |
| 6 | 74 | Lower | Q2 component |
| 7 | 78 | Upper | Q2 component |
| 8 | 80 | Upper | |
| 9 | 85 | Upper | Q3 component |
| 10 | 88 | Upper | Q3 component |
| 11 | 91 | Upper | |
| 12 | 95 | Upper | |

Q1 sits between positions 3 and 4. Q2 sits between positions 6 and 7. Q3 sits between positions 9 and 10. The pattern for even n is regular: the quartile boundaries fall between pairs of values.

### Range for the same data

Range = maximum minus minimum = 95 minus 62 = 33 beats per minute.

Notice the contrast. The range is 33, nearly double the IQR of 17, because it stretches to include the two most extreme volunteers. If one more volunteer had recorded 140 bpm after sprinting upstairs to the lab, the range would jump to 78 while the IQR would move only slightly.

## What happens when n is odd

Take a dataset of 11 values, a common size for a small pilot study:

14, 19, 21, 23, 26, 28, 31, 34, 38, 41, 47

The median is the 6th value, 28, because it has five values on each side.

Under the exclusive method, you drop the 28 from both halves. The lower half is 14, 19, 21, 23, 26 and the upper half is 31, 34, 38, 41, 47. Each half has five values, so each median is the 3rd value of that half.

Q1 = 21. Q3 = 38. IQR = 38 minus 21 = 17.

Under the inclusive method, you keep the 28 in both halves. The lower half becomes 14, 19, 21, 23, 26, 28 and the upper half becomes 28, 31, 34, 38, 41, 47. Each half now has six values, so each median is the average of the 3rd and 4th.

Q1 = (21 + 23) / 2 = 22. Q3 = (34 + 38) / 2 = 36. IQR = 36 minus 22 = 14.

Same eleven numbers. Two defensible methods. IQR of 17 or 14. This is exactly why you must name your method in a lab report and why comparing hand calculations to software output without checking the convention can send you chasing a phantom error.

## How software computes quartiles

Statistical packages do not all use the same definition. This is a real source of confusion when you move between tools.

### R

The base R function `quantile()` defaults to `type = 7`, which interpolates between order statistics using the formula position = 1 + (n minus 1) times p, where p is the target percentile. For the 12-value heart rate example, this gives Q1 = 69.75 and Q3 = 86.25, so the IQR is 16.5 rather than the 17 you get by hand with either the exclusive or inclusive method. R offers nine quantile types in total, and `type = 6` is closer to the exclusive method used in many textbooks. The `IQR()` function in base R calls `quantile()` under the hood, so it inherits the same default.

### Excel

Excel provides two relevant functions. `QUARTILE.INC` (and the legacy `QUARTILE`) uses an inclusive definition that matches the percentile-inclusive convention. `QUARTILE.EXC` uses an exclusive definition based on a different position formula. For the same 12 values, `QUARTILE.INC` returns Q1 = 69.75 and Q3 = 86.25, while `QUARTILE.EXC` returns Q1 = 69.5 and Q3 = 86.5, which matches the hand calculation above. Microsoft documents both functions and notes that `QUARTILE.EXC` returns an error when the requested quartile falls outside the range of the data, which can happen with very small samples.

The practical lesson: your spreadsheet and your textbook may disagree by a fraction of a unit, and neither is broken. Record which function or quantile type you used.

## Range versus IQR: choosing the right measure

Use the range when you want a fast, complete picture of the span of a small, clean dataset, such as replicate readings from a single instrument run where you expect no contamination. The range uses every value in the sense that it depends on the two extremes, so it captures the full extent of the data.

Use the IQR when the dataset may contain outliers, when the distribution is skewed, or when you are reporting alongside a median. Median and IQR travel together because both are rank-based and both resist distortion from extreme values. Mean and standard deviation travel together for roughly symmetric data without strong outliers.

Skewed data is the norm in biology, not the exception. Body mass index trajectories, physical activity levels, and biomarker concentrations typically produce long right tails. Studies that categorize participants into quartiles of an exposure, such as leisure-time physical activity or ultra-processed food intake, are working directly with the same quartile logic described here, splitting a continuous variable into four ranked groups for comparison [2][3]. Quartiles are not just a descriptive tool. They are a standard way to bin continuous exposures in epidemiology.

## Reading a boxplot

<figure class="article-figure">
  <img src="https://thumb.wikimedia.org/wikipedia/commons/thumb/e/ed/Box_Plot_Picture.png/1280px-Box_Plot_Picture.png" alt="Labeled box plot diagram showing minimum, Q1, median, Q3, maximum, and IQR on a number line from 1 to 15." loading="lazy" decoding="async" width="1000" height="325" />
  <figcaption>A labeled box plot illustrates how the five-number summary and IQR are displayed, helping you read quartiles and spread at a glance. Image: The Twists and Turns, CC0, via <a href="https://commons.wikimedia.org/wiki/File:Box_Plot_Picture.png" rel="noopener noreferrer">Wikimedia Commons</a>.</figcaption>
</figure>

A boxplot encodes the five-number summary in a single graphic. The box runs from Q1 to Q3, so the length of the box is the IQR. A line inside the box marks the median. Whiskers extend from the box toward the extremes, conventionally stopping at the most distant value that is still within 1.5 times the IQR of the box edge. Points beyond the whiskers are plotted individually as suspected outliers.

When you look at a boxplot, read it in this order:

1. The median line tells you the center.
2. The box height tells you the IQR, the spread of the middle half.
3. The whisker length tells you how far the non-outlier data extend.
4. Isolated points tell you where the extremes sit.

A long upper whisker with several points above it signals a right-skewed distribution. A short box with long whiskers on both sides signals a tight core with heavy tails. Two boxplots side by side compare groups at a glance, which is why they dominate figures in clinical papers.

## Common Mistakes and Limitations

**Forgetting to sort the data first.** Quartiles are defined by position in the ordered list. Computing them from the raw sequence produces meaningless numbers.

**Not stating exclusive versus inclusive.** For odd n, the two methods give different IQRs. A number without a stated method is incomplete.

**Treating the IQR as a percentage.** The IQR is a difference in the units of your data, not a proportion. An IQR of 17 beats per minute is not 17 percent of anything.

**Assuming software agrees with your hand calculation.** R's default quantile type and Excel's `QUARTILE.INC` and `QUARTILE.EXC` use different position formulas. Discrepancies of a fraction of a unit are expected.

**Using the range to describe outlier-prone data.** One bad measurement can double the range. The IQR will barely move.

**Calling every flagged point a true outlier.** The 1.5 times IQR rule is a flagging convention, not proof of error. In immunogenicity assay work, this rule has been criticized as overly conservative, removing too many values and biasing cut point estimates downward [1]. Flag, investigate, then decide.

**Reporting the IQR without the median.** The IQR describes spread around a center you have not named. Report them as a pair, for example "median 76 bpm, IQR 17 bpm."

**Applying these measures to categorical data.** Range and IQR require ordered numeric values. They are meaningless for categories like blood type or species name.

## Quick Review

- Range = maximum minus minimum. It uses only the two extreme values.
- IQR = Q3 minus Q1. It covers the middle 50 percent of the data.
- Always sort the data before finding any quartile.
- Q2 is the median. Q1 is the median of the lower half. Q3 is the median of the upper half.
- For odd n, the exclusive method drops the median from both halves and the inclusive method keeps it. State which you used.
- The IQR is robust to outliers. The range is not.
- R's default `quantile()` type and Excel's `QUARTILE.INC` and `QUARTILE.EXC` can return slightly different quartiles for the same data.

## Frequently Asked Questions

### What is the interquartile range in simple terms?

The interquartile range is the spread of the middle half of a dataset, calculated as the third quartile minus the first quartile. It tells you how far apart the 25th and 75th percentile values sit.

### How do you find the IQR step by step?

Order the data, find the median, find the median of the lower half (Q1) and the median of the upper half (Q3), then subtract Q1 from Q3. The result is the IQR in the same units as your data.

### Why do I get a different IQR than my software?

Software packages use different quartile definitions. R's default quantile type interpolates between order statistics, and Excel's `QUARTILE.INC` and `QUARTILE.EXC` follow different conventions. Check which method your tool uses and report it.

### Is the IQR the same as the range?

No. The range is the maximum minus the minimum and covers the full span of the data. The IQR covers only the middle 50 percent and ignores the tails.

### What does an IQR of zero mean?

An IQR of zero means Q1 and Q3 are equal, so at least half the values in the dataset share the same number. This happens with heavily tied or discrete data.

### When should I report the IQR instead of the range?

Report the IQR when the data are skewed or contain outliers, which is common in biological measurements. Report the range when you need the full extent of a small, clean dataset.

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "What is the interquartile range in simple terms?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The interquartile range is the spread of the middle half of a dataset, calculated as the third quartile minus the first quartile. It tells you how far apart the 25th and 75th percentile values sit."
      }
    },
    {
      "@type": "Question",
      "name": "How do you find the IQR step by step?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Order the data, find the median, find the median of the lower half (Q1) and the median of the upper half (Q3), then subtract Q1 from Q3. The result is the IQR in the same units as your data."
      }
    },
    {
      "@type": "Question",
      "name": "Why do I get a different IQR than my software?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Software packages use different quartile definitions. R's default quantile type interpolates between order statistics, and Excel's QUARTILE.INC and QUARTILE.EXC follow different conventions. Check which method your tool uses and report it."
      }
    },
    {
      "@type": "Question",
      "name": "Is the IQR the same as the range?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "No. The range is the maximum minus the minimum and covers the full span of the data. The IQR covers only the middle 50 percent and ignores the tails."
      }
    },
    {
      "@type": "Question",
      "name": "What does an IQR of zero mean?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "An IQR of zero means Q1 and Q3 are equal, so at least half the values in the dataset share the same number. This happens with heavily tied or discrete data."
      }
    },
    {
      "@type": "Question",
      "name": "When should I report the IQR instead of the range?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Report the IQR when the data are skewed or contain outliers, which is common in biological measurements. Report the range when you need the full extent of a small, clean dataset."
      }
    }
  ]
}
</script>

## Related Articles

- [Troubleshooting out-of-range QC results antimicrobial susceptibility testing](/knowledge/bacteria/general/troubleshooting-out-of-range-quality-control-results-in-antimicrobial-susceptibility-testing-a-syste)
- [Biotech Recruiters: How to Find and Work with the Best Agencies for Your](/blog/careers/biotech-recruiters-how-to-find-and-work-with-the-best-agencies-for-your-career)
- [Dynamic Range in Digital PCR](/knowledge/molecular-biology/dynamic-range-in-digital-pcr-how-partition-number-and-sample-dilution-determine-quantification-limit)
- [Long-Range PCR vs. Standard PCR](/knowledge/molecular-biology/long-range-pcr-vs-standard-pcr-choosing-the-right-approach-for-large-amplicons)
- [Statistical Range: Definition, Calculation, and Applications](/blog/guides/statistical-range-definition-calculation-and-applications)
- [Free-Range Layer Management and Range Stewardship](/knowledge/animal-farming/poultry/free-range-layer-management-and-range-stewardship)
## Further Reading

- [Associations of the CHG index combined with obesity indicators with cardiovascular disease in early CKM syndrome using CHARLS data.](https://pubmed.ncbi.nlm.nih.gov/42303740/)
- [Clinical and Socioeconomic Predictors of In-hospital Mortality in Acute Pulmonary Embolism: A Cross-sectional Study using the US National Inpatient Sample data.](https://pubmed.ncbi.nlm.nih.gov/42254463/)

## Sources

1. [A new method for identification of outliers in immunogenicity assay cut point data.](https://pubmed.ncbi.nlm.nih.gov/32615125/)
2. [Consumption of Ultra-Processed Foods and Increased Risks of Prostate Cancer in a Random Sample of United States Adults.](https://pubmed.ncbi.nlm.nih.gov/42567433/)
3. [Leisure-Time Physical Activity on Age-Modelled Trajectories of Body Mass Index and Obesity Risk Throughout Life: Multivariable Regression and Mendelian Randomization Analyses Using Electronic Health Record Data From the CORDELIA-Catalunya Study.](https://pubmed.ncbi.nlm.nih.gov/42426560/)