Smart Systems for Home

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

IQR in Excel: How to Calculate Interquartile Range

· 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 work out 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 far more resistant to outliers than the standard range or standard deviation.

The Interquartile Range is a critical tool for data analysts and researchers because it ignores the extreme ends of a dataset. While the standard range (Maximum minus Minimum) can be heavily skewed by a single erroneous entry or a rare extreme value, the IQR focuses on the core of the distribution. By calculating the difference between the 75th percentile and the 25th percentile, you gain a clear picture of where the bulk of your values reside, which is essential for creating box-and-whisker plots and identifying statistical outliers.

What You'll Need

  • A computer with Microsoft Excel installed (works across all modern versions, including Office 365, Excel 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. Prepare Your Data: Enter your numerical data into a single column. For this guide, assume your data is located in cells A2 through A101. Ensure there are no text strings or empty cells within the range, as this can sometimes lead to unexpected results or errors depending on the function used.
  2. Calculate the First Quartile (Q1): Select an empty cell where you want the Q1 value to appear (e.g., C2). Type the following formula: =QUARTILE.INC(A2:A101, 1). Press Enter. The number 1 tells Excel to find the 25th percentile of the dataset. Q1 is the median of the lower half of the data.
  3. Calculate the Third Quartile (Q3): Select another empty cell (e.g., C3). Type the following formula: =QUARTILE.INC(A2:A101, 3). Press Enter. The number 3 tells Excel to find the 75th percentile. Q3 is the median of the upper half of the data.
  4. Calculate the IQR: In a third cell (e.g., C4), subtract the Q1 value from the Q3 value. If you used the cells mentioned above, type: =C3-C2. Press Enter. The resulting value 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. In any empty cell, type: =QUARTILE.INC(A2:A101, 3) - QUARTILE.INC(A2:A101, 1). This calculates both quartiles and performs the subtraction in one step.
  6. Verify the Result: To ensure the calculation is correct, you can manually sort your data from smallest to largest using the Data > Sort menu. Visually check that your Q1 and Q3 values roughly align with the 25% and 75% marks of your list.

Common Mistakes

One of the most frequent errors is confusing QUARTILE.INC with QUARTILE.EXC. The .INC version (inclusive) includes the 0th and 4th percentiles in its calculation, making it the standard for most general business and academic purposes. The .EXC version (exclusive) excludes these extremes and is typically used in more specialized statistical research. Using the wrong one will result in slightly different Q1 and Q3 values, which will subsequently change your IQR.

Another common mistake is selecting the wrong range. If you include the header row (e.g., the cell that says "Price" or "Weight") in your formula range, Excel usually ignores the text, but it is a bad habit that can lead to #VALUE! errors if the cell contains non-numeric characters that Excel cannot interpret as empty. Always ensure your range starts exactly at the first number and ends at the last number.

Users also frequently forget to use absolute references when dragging formulas. If you are calculating the IQR for multiple columns of data, you must lock the range using dollar signs (e.g., $A$2:$A$101). Without these, as you drag the formula across the sheet, Excel will shift the range to B2:B101, C2:C101, and so on, which may lead to calculating the IQR of empty cells.

Tips

To make your spreadsheet more dynamic, instead of typing the range A2:A101 directly into the formula, use a Named Range. Highlight your data, go to the Name Box (the small field to the left of the formula bar), and type a name like MyData. Now your formula becomes =QUARTILE.INC(MyData, 3) - QUARTILE.INC(MyData, 1). This makes the formula much easier to read and maintain if your dataset grows.

If you are using the IQR to find outliers, you can use the "1.5 x IQR Rule." Create a cell for 1.5 * IQR. Any value in your dataset that is lower than Q1 - (1.5 * IQR) or higher than Q3 + (1.5 * IQR) is statistically considered an outlier. You can use Conditional Formatting to automatically highlight these cells in red, making them immediately visible in a large dataset.

For those who prefer a visual representation, Excel's Box and Whisker chart is the perfect companion to the IQR. Go to Insert > Insert Statistic Chart > Box and Whisker. This chart automatically calculates the IQR and displays the median, Q1, and Q3 visually, allowing you to see the spread and any outliers without writing a single formula.

Troubleshooting

If your formula returns a #NUM! error, it is usually because the range you selected is empty or contains no numerical values. Double-check that your data is actually formatted as "Number" or "General" and not as "Text." If numbers are stored as text, Excel cannot perform mathematical calculations on them. You can fix this by selecting the column, clicking the small warning icon that appears, and selecting "Convert to Number."

If the result seems impossibly high or low, check for "dirty data." A single typo—such as entering 1000 instead of 10—won't change the IQR as much as it would the range, but it can still shift the quartiles if the dataset is small. Use the Filter tool (Data > Filter) to sort your data and look for values that are clearly incorrect.

If you are using a very old version of Excel (pre-2010), QUARTILE.INC might not be available. In these cases, use the legacy QUARTILE function. The syntax is identical: =QUARTILE(range, quart). This function behaves exactly like QUARTILE.INC.

Frequently Asked Questions

What is the difference between Range and IQR?

The Range is the difference between the absolute maximum and minimum values. The IQR is the difference between the 75th and 25th percentiles. The IQR is preferred when data contains outliers because it describes the middle 50% of the data, ignoring the extremes.

Can I calculate IQR if my data isn't sorted?

Yes. The QUARTILE.INC function in Excel automatically handles the sorting process internally. You do not need to manually sort your data from smallest to largest for the formula to work correctly.

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

QUARTILE.INC is generally used for most business and general statistics as it is inclusive of the full range. QUARTILE.EXC is used more often in academic research or specific statistical models where the extreme edges of the sample are considered potentially misleading.

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 bounds is an outlier.

Does the IQR change if I add more data?

Yes, adding new data points can shift the positions of the 25th and 75th percentiles, which will change the IQR. This is why using Named Ranges or Excel Tables is helpful, as the formulas will update automatically when new rows are added.