What IQR is and why you need it
The interquartile range (IQR) measures the spread of the middle 50 percent of your data. It tells you how tightly or loosely your numbers cluster around the center. In Excel, you calculate it by finding the difference between the 75th percentile (third quartile) and the 25th percentile (first quartile) of your dataset.
IQR is useful when you want to spot outliers, understand data consistency, or compare how spread out different groups are. Unlike the full range (highest minus lowest), IQR ignores extreme values at both ends, so it gives you a clearer picture of where most of your data actually sits.
Key Takeaways
- IQR equals the third quartile (Q3) minus the first quartile (Q1), and you calculate each using the QUARTILE function in Excel.
- The QUARTILE function syntax is =QUARTILE(range, quartile_number), where quartile_number is 1 for Q1 and 3 for Q3.
- You can calculate IQR in a single cell by nesting both QUARTILE functions: =QUARTILE(A2:A20,3)-QUARTILE(A2:A20,1).
- Excel also offers QUARTILE.INC and QUARTILE.EXC functions that calculate quartiles slightly differently, though QUARTILE works for most situations.
Setting up your data in Excel
Before you calculate IQR, arrange your numbers in a single column with no blank cells between them. If your data has a header row, that is fine — just make sure your range starts below the header when you write your formula.
For example, if your numbers are in cells A2 through A20, that is your range. If they are scattered across multiple columns or have gaps, move them into a single continuous column first. The QUARTILE function needs a clean, unbroken list to work correctly.
Using QUARTILE to find Q1 and Q3
The QUARTILE function is the core tool for IQR calculation. It takes two pieces of information: your data range and which quartile you want (1 for Q1, 3 for Q3).
In a blank cell, type =QUARTILE(A2:A20,1) to find the first quartile. In another blank cell, type =QUARTILE(A2:A20,3) to find the third quartile. Press Enter after each formula. Excel will return two numbers — write these down or keep them visible, because you will subtract Q1 from Q3 next.
If your data is in a different column or range, replace A2:A20 with your actual cell references. The second number (1 or 3) never changes — it tells Excel which quartile to calculate.
Calculating IQR in a single formula
Instead of using two separate cells, you can calculate IQR in one cell by nesting the QUARTILE functions. In a blank cell, type:
=QUARTILE(A2:A20,3)-QUARTILE(A2:A20,1)
Press Enter. Excel subtracts Q1 from Q3 and shows you the IQR directly. This method is faster and keeps your spreadsheet cleaner, especially if you are calculating IQR for many datasets.
Make sure you replace A2:A20 with your actual data range. The formula works the same way regardless of how many numbers you have, as long as they are in one continuous column.
Understanding QUARTILE.INC and QUARTILE.EXC
Excel offers two versions of the quartile function: QUARTILE.INC (inclusive) and QUARTILE.EXC (exclusive). The original QUARTILE function behaves like QUARTILE.INC, which is what most people use.
QUARTILE.INC includes the minimum and maximum values in its calculation, while QUARTILE.EXC excludes them. For most everyday datasets, the difference is small. If you are working with a small dataset (fewer than 10 values) or need to match a specific statistical standard, check which version your organization or textbook requires. Otherwise, stick with QUARTILE or QUARTILE.INC.
The syntax is identical: =QUARTILE.INC(A2:A20,1) or =QUARTILE.EXC(A2:A20,3). Swap these into your formula the same way you would use QUARTILE.
Checking your results and spotting errors
After you calculate IQR, sanity-check the result. Q3 should always be larger than Q1, so your IQR should be a positive number. If you get zero or a negative number, you likely reversed the subtraction or used the wrong quartile numbers.
A common mistake is typing =QUARTILE(A2:A20,1)-QUARTILE(A2:A20,3) instead of the other way around. The correct order is always Q3 minus Q1. Another mistake is including blank cells or text in your range — QUARTILE will either ignore them or return an error, depending on where they sit.
If Excel shows #NUM! or #VALUE!, check that your range contains only numbers and that you used 1 and 3 (not 0, 2, or 4) for the quartile positions.
Using IQR to find outliers
Once you have your IQR, you can use it to identify outliers. Multiply your IQR by 1.5, then subtract that from Q1 (lower bound) and add it to Q3 (upper bound). Any data point outside these bounds is considered an outlier.
For example, if Q1 is 20, Q3 is 40, and IQR is 20, then 1.5 times IQR is 30. Your lower bound is 20 − 30 = −10 and your upper bound is 40 + 30 = 70. Any value below −10 or above 70 is an outlier. You can use conditional formatting or a formula to highlight these values in your spreadsheet.
Frequently Asked Questions
What if my data has negative numbers?
QUARTILE works with negative numbers the same way it works with positive ones. The function sorts all values from lowest to highest and finds the 25th and 75th percentile positions. Your IQR will still be correct. If Q1 is −5 and Q3 is 10, your IQR is 15.
Can I calculate IQR for data in multiple columns?
No, QUARTILE requires a single continuous range. If your data spans multiple columns, copy it into one column first. Alternatively, you can calculate IQR separately for each column and compare them side by side.
Does the order of my data matter?
No. QUARTILE automatically sorts your data internally, so it does not matter whether your numbers are in ascending order, descending order, or random order. The function will find the correct quartile positions regardless.
What is the difference between IQR and standard deviation?
IQR measures the range of the middle 50 percent of data and ignores outliers. Standard deviation measures how far values typically spread from the average and is affected by extreme values. Use IQR when you want to ignore outliers; use standard deviation when you want to account for all values equally.
Can I use QUARTILE on a filtered or sorted range?
QUARTILE uses all values in the range you specify, including hidden rows. If you have filtered data and want IQR of only the visible cells, use AGGREGATE instead: =AGGREGATE(12,5,A2:A20) for Q3 and =AGGREGATE(11,5,A2:A20) for Q1, then subtract. The 5 tells AGGREGATE to ignore hidden rows.