Compute IQR in Excel: A Step-by-Step Calculation Guide
In this article
To compute the Interquartile Range (IQR) in Excel, you subtract the first quartile (Q1) from the third quartile (Q3) using the formula =QUARTILE.INC(array, 3) - QUARTILE.INC(array, 1). The IQR measures the statistical dispersion of the middle 50% of your dataset, providing a more robust look at data spread than the standard range because it ignores extreme outliers at the high and low ends of the spectrum.
What You'll Need
- A computer with Microsoft Excel installed (any version from 2010 onwards is recommended for the .INC and .EXC functions).
- A dataset consisting of numerical values organized in a single column or row.
- Basic familiarity with entering formulas into Excel cells.
Step-by-Step
- Organize Your Data: Ensure your numerical data is placed in a continuous range. For example, place your numbers in cells A2 through A50. While Excel functions do not strictly require the data to be sorted from smallest to largest to calculate the IQR, sorting your data via the Data tab > Sort A to Z can help you visually verify that the quartiles the formula produces make logical sense.
- Identify the Range: Note the exact cell range of your data. If your numbers start at A2 and end at A50, your array is
A2:A50. You will use this range inside every quartile function you write. - Calculate the First Quartile (Q1): Select an empty cell where you want the Q1 value to appear. Type the formula
=QUARTILE.INC(A2:A50, 1)and press Enter. The "1" tells Excel to find the 25th percentile of the data. Q1 represents the middle value between the smallest number and the median of the dataset. - Calculate the Third Quartile (Q3): Select another empty cell for the Q3 value. Type the formula
=QUARTILE.INC(A2:A50, 3)and press Enter. The "3" tells Excel to find the 75th percentile. Q3 represents the middle value between the median and the highest value of the dataset. - Compute the IQR: In a third empty cell, create a subtraction formula to find the difference between the two quartiles. If your Q3 is in cell C2 and your Q1 is in cell C1, type
=C2-C1and press Enter. The resulting number is your Interquartile Range. - Alternative Single-Cell Method: If you do not need to see the individual Q1 and Q3 values, you can combine these steps into one formula. In an empty cell, type:
=QUARTILE.INC(A2:A50, 3) - QUARTILE.INC(A2:A50, 1). This performs both calculations and the subtraction simultaneously.
Common Mistakes
One of the most frequent errors is confusing the QUARTILE.INC and QUARTILE.EXC functions. The "INC" stands for inclusive, meaning it includes the 0th and 4th percentiles (the minimum and maximum). The "EXC" stands for exclusive, which excludes these extremes. While both are mathematically valid, they will yield slightly different results, especially in smaller datasets. If you are following a specific textbook or academic requirement, check which method is required; otherwise, QUARTILE.INC is the standard for most general business and data analysis tasks.
Another common mistake is selecting the wrong "quart" argument. Users often enter 2 instead of 1 or 3. Entering a 2 will return the median of the dataset. While the median is the center of the IQR, it is not one of the boundaries used to calculate the range. Always ensure you are subtracting the 1st quartile from the 3rd.
Users also frequently forget to lock their cell references when dragging formulas across a sheet. If you are calculating the IQR for multiple columns of data, use absolute references (e.g., $A$2:$A$50) so that the data range does not shift as you copy the formula to other cells.
Tips
To make your spreadsheet more dynamic, instead of typing the range A2:A50 directly into the formula, you can use a Named Range. Select your data, go to the Name Box (top left, next to the formula bar), and type "MyData". Now, your formula becomes =QUARTILE.INC(MyData, 3) - QUARTILE.INC(MyData, 1). This makes the formula much easier to read and maintain if you add more data later.
If you are using the IQR to find outliers, you can use the "1.5 x IQR Rule." Once you have calculated your IQR, multiply it by 1.5. 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 set up these boundary formulas in Excel to automatically highlight outliers using Conditional Formatting.
For those working with very large datasets, consider converting your data range into an official Excel Table (Ctrl + T). When you use a Table, your formulas can use structured references (like [Column1]), which automatically expand as you add new rows of data, ensuring your IQR remains current without needing to update the cell range manually.
Troubleshooting
If your formula returns a #NUM! error, it is usually because the "quart" argument is invalid. Ensure that the second part of your QUARTILE.INC formula is a number between 0 and 4. If you accidentally typed a letter or a number like 5, Excel will trigger this error.
If you see a #VALUE! error, check your data range. This happens when the range contains non-numerical data, such as text strings or cells that look like numbers but are formatted as text. To fix this, select your data column, go to the Home tab, and change the format to "Number." If the cells still don't convert, use the "Text to Columns" feature in the Data tab to force the conversion of text-numbers into actual numeric values.
If the result seems unexpectedly small or zero, check for duplicate values in your dataset. If more than 50% of your data points are the exact same number, Q1 and Q3 may be identical, resulting in an IQR of zero. This is not a formula error, but a reflection of the lack of variance in your data.
If you are using an extremely old version of Excel (pre-2010), the QUARTILE.INC and QUARTILE.EXC functions may not exist. In this case, use the legacy QUARTILE function. It behaves identically to 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 in a set. The IQR is the difference between the 75th and 25th percentiles. The IQR is generally preferred in statistics because it is not skewed by a few extremely high or low numbers.
Can I calculate IQR without sorting my data first?
Yes. Excel's QUARTILE.INC function handles the sorting internally. Whether your list is randomized or sorted from A to Z, the result will be the same.
Which is better: QUARTILE.INC or QUARTILE.EXC?
QUARTILE.INC (Inclusive) is more common for general business use and smaller samples. QUARTILE.EXC (Exclusive) is often used in more rigorous academic or statistical research where the endpoints are intentionally excluded to avoid bias in sample estimation.
How do I find the median using the same function?
You can find the median by using the formula =QUARTILE.INC(range, 2). This returns the 50th percentile, which is the definition of the median.
What does a very large IQR indicate?
A large IQR indicates that the middle 50% of your data is spread widely apart, suggesting high variability within the core of your dataset.
Does the IQR function work with empty cells?
Yes, Excel's quartile functions ignore empty cells and cells containing text within the range, calculating the quartiles based only on the available numerical entries.