You can calculate the interquartile range (IQR) in Excel without any add-ins: use =QUARTILE.INC(range,1) and =QUARTILE.INC(range,3) to get Q1 and Q3, then subtract Q1 from Q3. For the outlier fences that make IQR useful, also compute Q1 minus 1.5×IQR and Q3 plus 1.5×IQR. The whole job takes about five minutes once your data sits in a single clean column.
The IQR is the spread of the middle half of your data: the distance between the 25th percentile (Q1) and the 75th percentile (Q3). Because it ignores the extreme 25% at each end, it is a robust measure of spread. A single wild value can double a standard deviation but barely move the IQR, which is why IQR is the standard way to flag outliers and to describe skewed data such as house prices, response times or sensor readings. Note that menu labels and function names can differ slightly by Excel version, platform and region.
What You'll Need
- Excel on Windows, macOS, or Excel for the web. The functions below exist in Excel 2010 and later, including Microsoft 365.
- Your data in one column, one number per row, with a single header cell on top and no blank rows inside the range.
- Numbers stored as numbers. Text-formatted numbers and values with stray spaces will be ignored by the functions and quietly skew your result.
- A few empty cells beside the data for the Q1, Q3, IQR and fence calculations.
- At least four data points. With fewer, quartiles are poorly defined and the result is not meaningful.
Step-by-Step
- Lay out the data. Put your values in a single column, for example A2 down to A51, with a label such as "Value" in A1. Leave no blanks or subtotal rows inside the range. If you have several groups (for example, readings per room), keep each group in its own column so you can compare IQRs side by side.
- Check that the numbers are real numbers. Click the column and look at the status bar at the bottom of the window. If it shows a Sum and an Average, the values are numeric. If it shows only a Count, some cells are text. To fix text numbers, select the cells, open the warning icon that appears and choose Convert to Number, or use Data > Text to Columns and click Finish. Alternatively, put =VALUE(TRIM(A2)) in a helper column and fill down.
- Calculate Q1. In an empty cell type =QUARTILE.INC(A2:A51,1) and press Enter. This returns the 25th percentile using the inclusive method, which is what most statistics textbooks and spreadsheet tools use by default.
- Calculate Q3. In the next cell type =QUARTILE.INC(A2:A51,3) and press Enter. This is the 75th percentile.
- Subtract to get the IQR. In a third cell type =Q3cell-Q1cell using your actual cell references, for example =C3-C2. The result is your interquartile range. Label each cell so the sheet stays readable, since raw numbers with no labels are easy to misread later.
- Build the outlier fences. In two more cells, enter =Q1cell-1.5*IQRcell for the lower fence and =Q3cell+1.5*IQRcell for the upper fence. Any value below the lower fence or above the upper fence is a standard outlier. Some analysts use 3×IQR for "extreme" outliers, so add a second pair of fences if you want both tiers.
- Flag the outliers. In the first empty cell of the row beside your data, type =IF(OR(A2<lowerfence,A2>upperfence),"Outlier","") and fill it down the column. Replace the fence references with absolute references such as $C$6 and $C$7 so the formula copies correctly.
- Verify the quartile function. Excel also offers QUARTILE.EXC, which excludes the median and endpoints and returns slightly different values, especially on small samples. Whichever you choose, use it consistently for both Q1 and Q3; mixing the two methods produces a wrong IQR.
- Optionally visualise it. Select the data, then go to Insert > Insert Statistic Chart > Box and Whisker. The box spans Q1 to Q3, the line inside is the median, and points plotted beyond the whiskers are the outliers your fence formulas found. This pair of checks, formula and chart, catches most data-entry errors.
- Read the result. A small IQR means the middle half of the values is tightly packed; a large IQR means wide spread. Compare the IQR with the median to judge relative spread, and compare IQRs between groups to see which one varies more. If you need a single robust spread figure to quote, state the IQR in the units of your data, not as a percentage.
Common Mistakes
Including the header. If you select A1:A51 and A1 contains the word "Value", QUARTILE.INC ignores the text, so the result is usually fine, but your row counts and any AVERAGE formulas nearby will be wrong. Select the numbers only.
Mixing QUARTILE.INC and QUARTILE.EXC. A Q1 from one method and a Q3 from the other gives a nonsense IQR. Pick one and document it in a cell note.
Using STDEV as a stand-in. Standard deviation is sensitive to outliers; a single error of two extra zeros can blow it up. That is the whole reason IQR exists, so do not judge spread with STDEV on data you know is skewed.
Treating outliers as errors. A flagged value is not automatically wrong. It may be a legitimate extreme, a data-entry mistake, or a different population mixed in. Investigate each one before deleting anything.
Relative references that break on fill. When you drag the flag formula down, the fence cells shift unless they are locked with dollar signs. This is the most common cause of "my flags are all wrong below row 10".
Blanks and zero-length text. Blank cells are skipped by the quartile functions, but a cell containing only a space counts as text and can shift the calculation. Clean the column first with Data > Remove Duplicates or a TRIM helper column.
Tips
Put the Q1, Q3, IQR and fence values in named cells (Formulas > Define Name) so your flag formulas read like =IF(OR(A2<LowerFence,A2>UpperFence),"Outlier",""), which is far easier to audit.
Use =PERCENTILE.INC(range,0.25) as a cross-check. It should return the same value as QUARTILE.INC with 1, and a mismatch tells you a range reference is off.
If you compare groups, calculate the IQR for each column separately rather than for the whole table. Pooling groups with different centres can inflate the IQR and hide real differences.
Keep a duplicate of the raw column before you clean or delete anything. Excel has no built-in undo history once the file is closed, and cleaning steps are hard to reverse.
For repeated work, turn the five formula cells into a small template sheet so future datasets only need a range pasted in.
Troubleshooting
The formula returns #NUM!. The range is empty or contains too few numbers. Confirm the cells hold digits and that you passed 1 or 3 as the quart argument.
The formula returns #VALUE!. One of the arguments is text. Check whether your range accidentally includes a label cell or a dash used as a placeholder for missing data. Replace dashes with blanks.
IQR is zero. More than half your values are identical, which is plausible with coarse data such as star ratings. Nothing is broken; IQR just cannot distinguish spread when the middle is flat.
The box-and-whisker chart disagrees with your fences. The chart uses its own quartile settings and may display whiskers differently from 1.5×IQR on small samples. Trust the formulas for exact numbers and treat the chart as a visual aid.
Flags appear on every row. Your fence references almost certainly shifted during the fill. Retype the first formula with $ locks and fill down again.
If none of that worked, paste a copy of the column into a fresh sheet, re-enter the numbers with Data > Text to Columns, and rebuild the formulas there. Starting clean resolves most hidden-formatting problems faster than diagnosing them.
Frequently Asked Questions
Should I use QUARTILE.INC or QUARTILE.EXC?
INC is the common default and matches most textbook definitions. EXC is used in some statistical software. The IQR differs slightly between them on small samples, so choose one and apply it to both quartiles.
What counts as an outlier with IQR?
Any value below Q1 − 1.5×IQR or above Q3 + 1.5×IQR. Values beyond 3×IQR are often called extreme outliers.
Does IQR work with negative numbers?
Yes. IQR is a difference, so it is always zero or positive even when the data contains negative values.
Can I calculate IQR in Google Sheets?
Yes, with the same function names: QUARTILE.INC and QUARTILE.EXC both work there, so formulas copy across between the two apps.
Why is IQR better than standard deviation here?
Standard deviation squares distances from the mean and is pulled around by a few extreme values. IQR describes the middle half of the data, so it stays stable when the tails are messy or skewed.
Do I need the Analysis ToolPak?
No. The built-in quartile functions are enough. The ToolPak's descriptive statistics output does not include IQR, so the formulas above are the direct route.