To calculate an interquartile range (IQR) in Excel and use it to flag outliers at roughly the 95% level, you need two things: the quartile values and a simple subtraction. The IQR itself is Q3 minus Q1. Excel has no single IQR function, so you build it from QUARTILE.INC (or QUARTILE.EXC) and then apply the common 1.5×IQR rule. That rule is not exactly a 95% interval, but it is the standard outlier screen people mean when they say "IQR 95%." If you truly need a 95% confidence interval for the mean, that is a different calculation using the t-distribution, covered near the end. Menu labels and function names can differ slightly by Excel version and region.
What You'll Need
- A column of numeric data with no blank cells inside the range you select.
- Excel 2010 or later for QUARTILE.INC and QUARTILE.EXC; older versions use QUARTILE.
- A spare cell for each result: Q1, Q3, IQR, lower fence, upper fence.
- Optional: the Analysis ToolPak add-in if you want the descriptive statistics output instead of formulas.
Step-by-Step
- Lay out your data. Put your numbers in a single column, for example A2:A101, with a header in A1. Remove text, blanks, and error values from that block, because QUARTILE functions ignore blanks but will error on text in some versions.
- Calculate Q1. In an empty cell, type
=QUARTILE.INC(A2:A101,1)and press Enter. This returns the first quartile using the inclusive method, which matches most textbook and business usage. - Calculate Q3. In the next cell, type
=QUARTILE.INC(A2:A101,3). This returns the third quartile. - Subtract to get the IQR. In a third cell, type
=Q3cell-Q1cell, replacing the cell references with the two cells you just filled. For example, if Q1 is in C2 and Q3 is in C3, use=C3-C2. The result is your interquartile range. - Build the lower fence. In a new cell, type
=Q1cell-1.5*IQRcell. Any value below this fence is a mild outlier under the standard rule. - Build the upper fence. In a new cell, type
=Q3cell+1.5*IQRcell. Any value above this is a mild outlier. - Flag outliers. In the first empty cell beside your data, type
=IF(OR(A2and fill down. Replace the fence references with absolute references such as $C$6 and $C$7 so the formula copies correctly.upperfence),"Outlier","") - Optional: use the exclusive method. If your audience expects QUARTILE.EXC, swap the function name in steps 2 and 3. EXC excludes the median when splitting the data and gives slightly wider fences on small samples.
- Optional: 3×IQR for extreme outliers. Repeat steps 5 and 6 with 3 instead of 1.5 to flag only extreme values. Many analysts report both.
- Optional: a true 95% confidence interval. If your goal is a 95% interval for the mean rather than an outlier screen, use
=AVERAGE(A2:A101),=STDEV.S(A2:A101),=COUNT(A2:A101), then=T.INV.2T(0.05,COUNT-1)for the critical value. The interval is mean ± critical value × standard deviation ÷ square root of count.
Common Mistakes
- Using QUARTILE.INC and QUARTILE.EXC interchangeably. They give different Q1 and Q3 on the same data, so your fences shift. Pick one and state it.
- Forgetting absolute references. When you fill the outlier formula down, relative fence references drift and every row compares against the wrong number.
- Including the header row. Text in the range can produce a #VALUE! error or silently skew the count.
- Treating 1.5×IQR as a 95% interval. It is a rule of thumb, not a probability statement. On skewed data it flags a different share of points than 5%.
- Leaving blanks inside the range. QUARTILE ignores blanks, but AVERAGE and STDEV.S also ignore them, so a count mismatch can make a confidence interval too narrow.
- Deleting rows instead of flagging them. Remove outliers only after you have documented why; deleting changes the quartiles themselves.
Tips
- Name your cells. Select a cell, type a name in the Name Box, and use that name in formulas so the sheet reads clearly.
- Use conditional formatting with a formula rule to shade outliers instead of adding a helper column.
- For grouped data, build a small table with Q1, Q3, IQR, and both fences per group, then use AVERAGEIFS and the same formulas per group.
- Round only for display. Keep full precision in the calculation cells.
- If you need the descriptive statistics block, enable the Analysis ToolPak via File > Options > Add-ins, then use Data > Data Analysis > Descriptive Statistics. It reports quartiles but not the fences.
Troubleshooting
- #NUM! error: the quartile argument is outside 0–4, or the range has too few numeric values for QUARTILE.EXC. EXC needs at least two points and behaves oddly on tiny samples.
- #VALUE! error: text or an error value sits inside the range. Use Go To Special > Constants to find text cells, or wrap the range in a filter.
- IQR comes out zero: more than half your values are identical, so Q1 and Q3 coincide. Check for a stuck sensor or a copy-paste error.
- Fences look wrong after copying: confirm the fence cells use $ absolute references and that the data reference is relative.
- Formulas show as text: the cell is formatted as Text. Change the format to General and re-enter the formula.
- Results differ from a colleague's: compare whether each of you used INC or EXC and whether blanks were excluded.
Frequently Asked Questions
Does Excel have a built-in IQR function?
No. You calculate it as Q3 minus Q1 using QUARTILE.INC or QUARTILE.EXC.
Is 1.5×IQR the same as a 95% interval?
No. It is a conventional outlier rule. A 95% confidence interval for the mean uses the t-distribution and the standard error instead.
Should I use INC or EXC?
Use INC for most business and textbook work. Use EXC when your source explicitly specifies the exclusive method.
Can I calculate IQR for multiple groups at once?
Not with a single formula. Build one row per group and use QUARTILE.INC with a filtered range or an array formula per group.
Why does my IQR change when I add one value?
Quartiles are positional, so adding a value shifts the positions and can move Q1 or Q3, especially in small samples.
Do blanks affect the quartile result?
QUARTILE functions ignore blank cells, but blanks inside a range can still confuse COUNT and AVERAGE used alongside them.