Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Interquartile Range IQR in Excel: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To calculate the Interquartile Range (IQR) in Excel, subtract the first quartile (Q1) from the third quartile (Q3) using the formula =QUARTILE.INC(array, 3) - QUARTILE.INC(array, 1). The IQR represents the middle 50% of your data, providing a measure of statistical dispersion that is more resistant to outliers than the standard deviation or range.

What You'll Need

  • A computer with Microsoft Excel installed (all modern versions including Office 365, 2021, 2019, and 2016).
  • A dataset consisting of numerical values organized in a single column or row.
  • Basic familiarity with entering formulas into Excel cells.

Step-by-Step

  1. Organize Your Data: Ensure your numerical data is placed in a continuous range. For example, place your numbers in cells A2 through A21. While Excel's QUARTILE functions do not strictly require the data to be sorted in ascending order to work, sorting your data via the Data tab > Sort A to Z can help you visually verify that the calculated quartiles make sense.
  2. Calculate the First Quartile (Q1): Select an empty cell where you want the Q1 value to appear. Type the formula =QUARTILE.INC(A2:A21, 1) and press Enter. The "INC" stands for inclusive, meaning it includes the 0th and 4th percentiles. The number "1" tells Excel you want the 25th percentile of the dataset.
  3. Calculate the Third Quartile (Q3): Select another empty cell. Type the formula =QUARTILE.INC(A2:A21, 3) and press Enter. The number "3" tells Excel to find the 75th percentile. This value represents the upper boundary of the middle 50% of your data.
  4. Calculate the IQR: In a third cell, subtract the Q1 result from the Q3 result. If your Q1 is in cell B1 and your Q3 is in cell B2, type =B2-B1 and press Enter. This final number is your Interquartile Range.
  5. Alternative Single-Cell Method: If you do not need to see the individual quartile values, you can combine these steps into one master formula: =QUARTILE.INC(A2:A21, 3) - QUARTILE.INC(A2:A21, 1). This calculates both quartiles and performs the subtraction in one operation.
  6. Verify with a Box Plot (Optional): To visually confirm your IQR, highlight your data range, go to the Insert tab, click the Histogram icon, and select Box and Whisker. The height of the "box" in the chart represents the IQR.

Common Mistakes

One of the most frequent errors is confusing the QUARTILE.INC and QUARTILE.EXC functions. The .INC (inclusive) version is the standard for most business and general statistics, as it includes the minimum and maximum values in its calculation. The .EXC (exclusive) version excludes these extremes and is often used in specific academic or high-level statistical research. Using the wrong one will result in slightly different Q1 and Q3 values, which changes your final IQR.

Another common mistake is selecting the wrong range or including non-numeric cells. If your range includes a header (like the word "Price") or a blank cell that Excel interprets as a zero, your quartiles will be skewed. Always ensure your array reference (e.g., A2:A21) only covers the actual numbers.

Users also sometimes mistake the Median (Q2) for one of the quartiles. Remember that the IQR is specifically the distance between the 25th and 75th percentiles. Including the median in your subtraction formula will give you the Semi-Interquartile Range, not the full IQR.

Tips

To make your spreadsheet dynamic, use Named Ranges. Instead of typing A2:A21, highlight your data, right-click, and select "Define Name." Name it "SalesData." Your formula then becomes =QUARTILE.INC(SalesData, 3) - QUARTILE.INC(SalesData, 1). This makes the formula much easier to read and maintain if you move your data to a different sheet.

If you are dealing with a very large dataset that changes frequently, consider converting your data range into an Excel Table (Ctrl + T). When you add new rows to a Table, Excel automatically expands the range references in your formulas, meaning your IQR will update in real-time without you having to manually change the cell coordinates.

Use the IQR to identify outliers using the "1.5 x IQR Rule." Once you have your IQR, multiply it by 1.5. Any value that is lower than Q1 - (1.5 * IQR) or higher than Q3 + (1.5 * IQR) is statistically considered an outlier. You can set up a conditional formatting rule in Excel to highlight these cells automatically based on these calculations.

Troubleshooting

If your formula returns a #NUM! error, it is usually because the second argument (the quartile number) is not between 0 and 4. Check your formula to ensure you have used 1 for Q1 and 3 for Q3. If you accidentally typed 5 or -1, Excel cannot process the request.

If you see a #VALUE! error, it means there is something in your selected range that Excel cannot treat as a number. Check for hidden spaces, text characters, or cells formatted as "Text" instead of "Number." You can use the =ISNUMBER() function on your data cells to find the culprit.

If the result seems impossibly large or small, double-check that your data is consistent. For example, if most of your data is in the hundreds but one entry is accidentally typed as 10,000, the IQR will remain stable, but your overall range will explode. While IQR is resistant to outliers, extreme data entry errors can still shift the quartiles if the sample size is very small.

If the QUARTILE.INC function is not appearing in your version of Excel, you can use the older QUARTILE function. It behaves identically to QUARTILE.INC. Simply use =QUARTILE(A2:A21, 1).

Frequently Asked Questions

What is the difference between IQR and Standard Deviation?

Standard deviation measures the average distance of every data point from the mean, making it very sensitive to extreme outliers. IQR only measures the spread of the middle 50% of the data, meaning it ignores the extremes entirely. This makes IQR a better choice for skewed data.

Can I calculate IQR if my data is not sorted?

Yes. Excel's QUARTILE.INC and QUARTILE.EXC functions perform the sorting internally. You do not need to manually sort your list from smallest to largest for the formula to return the correct result.

Which is better: QUARTILE.INC or QUARTILE.EXC?

For most general purposes and business reporting, QUARTILE.INC is the standard. QUARTILE.EXC is typically used in more rigorous statistical contexts where the sample is considered a representative subset of a much larger population and the extremes should be excluded from the quartile boundaries.

How do I use IQR to find outliers in Excel?

Calculate the IQR, then multiply it by 1.5. Subtract this value from Q1 to find the lower bound and add it to Q3 to find the upper bound. Any data point outside these two boundaries is an outlier.

Does the IQR change if I add more data?

Yes. Because the IQR is based on the position of the 25th and 75th percentiles, adding new data points will shift those positions and likely change the values of Q1 and Q3, thereby changing the IQR.

What does an IQR of 0 mean?

An IQR of 0 indicates that the 25th percentile and the 75th percentile are the same value. This happens when at least 50% of your data consists of the exact same number.