You find the three quartiles by sorting the data ascending, locating the median, then taking the median of the lower half (Q1) and the median of the upper half (Q3). That half-splitting method is what most introductory courses teach, and it gives clean answers for small data sets. Statistical software usually uses a different position formula, so the same numbers can produce slightly different quartiles depending on the tool. Know which convention you're following before you report a result.

What Q1, Q2, and Q3 Actually Represent in a Data Set

Quartiles divide a sorted data set into four groups with roughly equal counts. Q2 is the median, the 50th percentile. Q1 sits at the 25th percentile and Q3 at the 75th. The interquartile range, or IQR, is Q3 minus Q1, and it describes the spread of the middle half of your observations.

The word "roughly" matters here. With 10 data points you can't split the list into four groups of 2.5, so the quartile boundary falls between values and must be interpolated. That interpolation is where methods diverge. A textbook that says "median of the lower half" and a spreadsheet that says "25th percentile" will agree on large, smooth data sets and disagree on small ones.

Quartiles answer a specific question: where does a value sit relative to the rest of the batch? If your Q3 for monthly support tickets is 48 and a new month logs 61, that month is in the top quarter of volumes. You don't need the mean or standard deviation to make that call. For skewed data like income, wait times, or file sizes, quartiles are more honest than an average because one extreme value can't drag them far.

One boundary to set early: decide whether your data is a sample or a population before you reach for software. Excel's legacy QUARTILE function and QUARTILE.INC treat the data as a population, while QUARTILE.EXC excludes the median from the halves and matches the exclusive method used in some statistical texts. The two can return different Q1 and Q3 values on identical data, so state your convention in any report you share.

Sort the Data First: The Step That Changes Every Answer

Quartiles are positional, so an unsorted column produces garbage. Sort ascending, smallest to largest, and keep a count of how many values you have. That count, usually written n, decides which method you can use and how the halves split. Losing or duplicating a row during sorting is the most common silent error in hand calculations.

1: Enter or paste your values into a single column with no blank cells. 2: Select the column and use Data > Sort > Smallest to Largest in Excel, or Sort > Ascending in Google Sheets. 3: Write down n, the number of values, and check it against your source count. 4: Number the sorted values from 1 to n so you can reference positions directly. 5: Scan for duplicates and outliers that may be data-entry errors before you calculate anything.

The failure case to watch: blank cells and text entries. Excel's QUARTILE functions ignore text and empty cells inside a range, which quietly shrinks your n and shifts every quartile. If your range covers A2:A101 but row 47 is blank, you're calculating on 99 values, not 100. Use COUNTA on the range and compare it with your expected count before trusting the output.

Another trap is mixing units. If some wait times are in minutes and others in seconds, sorting puts the seconds values at the bottom and corrupts every quartile. Convert to one unit first. The same applies to dates stored as text, which sort alphabetically rather than chronologically and scatter your order.

The Median Comes First: Finding Q2 in Odd and Even Data Sets

The median is the middle value of the sorted list. With an odd n, it's the value at position (n + 1) / 2. With an even n, it's the average of the two middle values at positions n / 2 and n / 2 + 1. Everything else in the quartile calculation hangs off this step, so get it right before moving on.

Take the sorted list 3, 5, 7, 8, 12, 15, 18, 21, 24. That's n = 9, odd. The median position is (9 + 1) / 2 = 5, so Q2 = 12. The value 12 splits the list into four values below and four above. No averaging needed, and the quartiles that follow will be clean.

Now take 3, 5, 7, 8, 12, 15, 18, 21. That's n = 8, even. The two middle values sit at positions 4 and 5: 8 and 12. Q2 = (8 + 12) / 2 = 10. That 10 doesn't appear in the original data, which is normal for medians of even-count sets and trips up people who expect every quartile to be an observed value.

A quick sanity check: count how many values fall below your Q2 and how many above. They should be equal, or differ by one when n is odd. If they don't, you've miscounted or missed a duplicate during sorting. Fix that before calculating Q1 and Q3, because an error at the median propagates to both.

Median of the Lower Half and Upper Half: The Textbook Method, Worked Twice

This is the method most school curricula and introductory statistics courses use. Split the sorted data at the median, exclude the median itself when n is odd, and take the median of each remaining half. It's sometimes called the Moore and McCabe method, named after the statisticians whose textbook popularized it.

Worked example, odd n. Sorted data: 3, 5, 7, 8, 12, 15, 18, 21, 24. Q2 = 12. The lower half is 3, 5, 7, 8 and the upper half is 15, 18, 21, 24. Each half has four values, so Q1 = (5 + 7) / 2 = 6 and Q3 = (18 + 21) / 2 = 19.5. The IQR is 19.5 − 6 = 13.5.

Worked example, even n. Sorted data: 3, 5, 7, 8, 12, 15, 18, 21. Q2 = 10. The lower half is 3, 5, 7, 8 and the upper half is 12, 15, 18, 21. Q1 = (5 + 7) / 2 = 6 and Q3 = (15 + 18) / 2 = 16.5. The IQR is 10.5.

The n = 8 case matters because a popular shortcut says "for even n, Q1 is the median of the first n/2 values and Q3 is the median of the last n/2 values." That's exactly what the steps above do, and it's why this method is easy to teach. The shortcut breaks when n is odd and you forget to exclude the median. Reusing 12 in both halves pulls Q1 up and Q3 down, narrowing the IQR and understating the spread.

Position Formulas: How Excel and Google Sheets Pick Quartiles

Spreadsheets don't use the median-of-halves method. They compute a position with a formula, then interpolate between the two nearest values. Excel's QUARTILE.INC and Google Sheets' QUARTILE use the same inclusive approach. The formula Excel documents is p = 1 + (n − 1) × k, where k is 0.25 for Q1, 0.5 for Q2, and 0.75 for Q3.

Run it on the n = 8 data. For Q1, p = 1 + 7 × 0.25 = 2.75. The value sits between position 2 (which is 5) and position 3 (which is 7). Interpolate: 5 + 0.75 × (7 − 5) = 6.5. For Q3, p = 1 + 7 × 0.75 = 6.25, between position 6 (15) and position 7 (18): 15 + 0.25 × 3 = 15.75. Compare that with the median-of-halves answer of Q1 = 6 and Q3 = 16.5.

Measure Median-of-halves (n = 8) Excel QUARTILE.INC (n = 8) Difference
Q1 6 6.5 0.5
Q2 10 10 0
Q3 16.5 15.75 0.75
IQR 10.5 9.25 1.25

The two methods always agree on Q2 because both target the same 50th percentile. They diverge at Q1 and Q3, and the gap grows as the data set shrinks. With 100 or more values the difference is usually trivial, often a fraction of a unit. With 8 to 12 values it can shift your IQR by more than a full unit, which matters if you're flagging outliers with the 1.5 × IQR rule.

Neither method is wrong. They are different definitions of a percentile. Pick one, apply it consistently, and note it in any report. If you're matching a textbook answer, use the halves method. If you're matching a spreadsheet formula, use QUARTILE.INC and trust the output.

QUARTILE.EXC vs QUARTILE.INC: Why Your Calculator Disagrees With Excel

Excel's QUARTILE.EXC uses p = (n + 1) × k. For our n = 8 data, Q1 gives p = 9 × 0.25 = 2.25, interpolating to 5 + 0.25 × 2 = 5.5. Q3 gives p = 9 × 0.75 = 6.75, interpolating to 15 + 0.75 × 3 = 17.25. Those are further from the inclusive results than the halves method was. The exclusive formula cannot return a value when p falls below 1 or above n, which is why Excel shows #NUM! for QUARTILE.EXC on very small data sets.

Data set Q1 halves Q1 INC Q1 EXC Q3 halves Q3 INC Q3 EXC
n = 8 6 6.5 5.5 16.5 15.75 17.25
n = 9 6 7 5.5 19.5 19 20.5

The n = 9 row is worth sitting with. The halves method gives Q1 = 6, Excel's inclusive formula gives Q1 = 7, and the exclusive formula gives Q1 = 5.5. Same nine numbers, three different Q1 values. If you're grading homework, the textbook answer and the Excel answer won't match, and knowing why saves you an hour of confusion.

The practical rule: use QUARTILE.INC when your data is a complete population, and QUARTILE.EXC when you're treating the data as a sample and want a percentile definition that excludes the endpoints. Google Sheets labels its functions QUARTILE.INC and QUARTILE.EXC the same way, so a sheet copied to Excel keeps the same answers. LibreOffice Calc's QUARTILE function matches INC; its QUARTILE.EXC matches Excel's exclusive version.

Read a Five-Number Summary and IQR Straight Off Your Results

The five-number summary is minimum, Q1, median, Q3, maximum. That's the input to a box plot and the fastest way to describe a data set in one line. Once you have the three quartiles, the summary is arithmetic you can finish in your head. The IQR, Q3 − Q1, is the spread of the middle half.

Take fresh numbers in seconds: weekly delivery times in hours, sorted: 2, 4, 4, 5, 6, 6, 7, 8, 9, 11, 13, 15. That's n = 12. For Q2, the median falls between positions 6 and 7: (6 + 7) / 2 = 6.5. The lower half is 2, 4, 4, 5, 6, 6, giving Q1 = (4 + 5) / 2 = 4.5. The upper half is 7, 8, 9, 11, 13, 15, giving Q3 = (9 + 11) / 2 = 10. IQR = 5.5. The five-number summary is 2, 4.5, 6.5, 10, 15.

Use the IQR to flag outliers. A common threshold is any value below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR. Here that's below 4.5 − 8.25 = −3.75 or above 10 + 8.25 = 18.25. None of the delivery times trip the threshold. Run the same rule on a column of 500 customer orders and it usually catches a handful of data-entry errors or genuine extreme cases.

Box plots draw the whiskers to those thresholds, not always to the raw min and max. If you see a point beyond a whisker, that's an outlier by the 1.5 × IQR rule, not a plotting error. Read the box edges as Q1 and Q3, the line inside as the median, and you're reading the chart correctly.

Counting by Hand: A Fast Check Before You Trust Software

A quick manual pass catches spreadsheet errors before they reach a report. With fewer than 20 values, the whole calculation takes under two minutes. Write the sorted values on paper with position numbers underneath, then work left to right.

1: Sort the values ascending and write position numbers 1 to n under each value. 2: Mark the middle position. If n is odd, circle one value. If even, circle the two middle values and average them. 3: Count the values strictly below the median, then find the middle of that group for Q1. 4: Count the values strictly above the median and find the middle of that group for Q3. 5: Subtract Q1 from Q3 to get the IQR. 6: Compare your results with the spreadsheet output and investigate any gap above one unit.

If your hand count and the spreadsheet disagree by more than interpolation can explain, the usual culprit is a blank cell, a hidden row, or a text-formatted number inside the range. Right-click the range and check Format Cells > Number. Values stored as text usually sit left-aligned in their cell, which is the tell.

A second check: run MEDIAN on your full range and compare it with the spreadsheet's Q2. They should be identical to the last decimal. If MEDIAN and QUARTILE.INC(…, 2) disagree, either a cell contains text or you've selected a range with an off-by-one boundary. Both are fast to fix and faster to catch now than after the report goes out.

Building the Calculation in Excel, Google Sheets, and Python

Excel's modern function is =QUARTILE.INC(range, quart), where quart is 1, 2, or 3. Use =QUARTILE.INC(A2:A101,1) for Q1 and =QUARTILE.INC(A2:A101,3) for Q3. The legacy =QUARTILE(range, quart) still works and returns the same values, but it's flagged for compatibility and new workbooks should use the .INC version. For exclusive quartiles, use =QUARTILE.EXC(range, quart) and be ready for #NUM! on small data.

Google Sheets uses =QUARTILE(range, quart) for the inclusive version and =QUARTILE.EXC(range, quart) for the exclusive version. The function name without a suffix is inclusive, which mirrors Excel's QUARTILE.INC. Cross-file compatibility holds for the .INC and .EXC functions; older Sheets files saved with plain QUARTILE match INC. The IQR formula is just =QUARTILE.INC(A2:A101,3)-QUARTILE.INC(A2:A101,1) in either app.

Python's NumPy library uses =np.percentile(data, 25) for Q1 and 75 for Q3, with the default linear interpolation matching Excel's inclusive method. Pandas adds =series.quantile(0.25) with the same default. If you need the exclusive method in Python, pass interpolation='midpoint' or implement the (n + 1) × k formula directly, because the library defaults to inclusive.

Two things trip people up in code. First, don't include header rows in range selections; a string header in row 1 will break the calculation or shift the range. Second, don't compute quartiles on a filtered or pivot summary unless the summary preserves every underlying value. Quartiles of averages are not quartiles of the raw data, and the result can be badly misleading.

Common Mistakes and Edge Cases That Skew Quartiles

The most common mistake is forgetting to sort. The second is including the median in both halves when n is odd, which narrows the IQR. The third is mixing methods mid-report: computing Q1 by halves and Q3 by formula, then presenting a summary that matches neither.

All-equal data is a genuine edge case. If every value is 7, then Q1 = Q2 = Q3 = 7 and the IQR is 0. Some plotting tools draw a flat box; others fail to draw anything. That's not a software bug, it's the definition. Report the IQR as 0 and note that the data has no spread.

Very small data sets break the exclusive methods. With n = 3, QUARTILE.EXC returns #NUM! for both Q1 and Q3 because the position formula lands outside the data range. The halves method still works: sorted 4, 9, 14 gives Q2 = 9, Q1 = 4, Q3 = 14. If you have fewer than four data points, quartiles aren't meaningful and you should report the raw values instead.

Missing values handled inconsistently ruin comparisons across groups. If team A's numbers drop blanks and team B's keep zeros, their quartiles aren't comparable. Choose one policy for missing data, apply it to every group, and write it down. The same applies to whether a zero means "zero observed" or "no record" — those are different data and mixing them produces quartiles that describe nothing real.

FAQ

What is the fastest way to find Q1 and Q3 in Excel?

Use =QUARTILE.INC(A2:A101,1) for Q1 and =QUARTILE.INC(A2:A101,3) for Q3, selecting the full data range with no header row. The function returns in under a second regardless of data size and interpolates correctly for both odd and even counts. If you call =QUARTILE(range, quart) on a file created before 2010, it returns the same inclusive values.

Do I include the median when finding Q1 and Q3?

Not with the median-of-halves method. When n is odd, remove the median before taking the median of each half. With n = 9 and median position 5, the lower half is positions 1–4 and the upper half is positions 6–9. Including the median in both halves pulls Q1 up and Q3 down, which shrinks the IQR by up to one full data step.

Why does my calculator give a different Q1 than Excel?

Calculators from Texas Instruments and Casio typically default to the median-of-halves method, while Excel's QUARTILE.INC uses the 1 + (n − 1) × k position formula and interpolates. On the n = 9 data set above, the calculator returns Q1 = 6 and Excel returns Q1 = 7. The difference is convention, not error, and it disappears as n grows.

What if all my values are the same?

Q1, Q2, and Q3 all equal that single value, and the IQR is 0. Some charting tools won't draw a box when the IQR is 0, which is expected behavior and not a plotting fault. Report the IQR as 0 and note that there's no spread to describe, rather than switching methods to manufacture a difference.

Can I calculate quartiles on grouped or bucketed data?

Only approximately, and the approximation can be off by a full bucket width. A frequency table that reports counts per range doesn't preserve the individual values, so Q1 and Q3 can only be estimated by assuming values sit at each bucket's midpoint. If you can recover the underlying list, use it; grouped quartiles are estimates, not measurements.

How many data points do I need for quartiles to mean anything?

Four is the technical floor. In practice, fewer than 20 values makes the quartiles highly sensitive to the chosen interpolation method, and IQR-based outlier rules flag far more false positives. With under 10 values, report the sorted list and the median; add Q1 and Q3 with a note about which method you used.

What's the difference between IQR and standard deviation?

The IQR covers the middle half of the data and ignores both tails; standard deviation uses every value and is heavily affected by extremes. For skewed data like income or response times, the IQR is the better spread measure. For roughly symmetric, bell-shaped data, standard deviation carries more information because it uses the full data set.

Does QUARTILE.EXC ever match the median-of-halves answer?

Rarely, and never reliably. The exclusive formula uses (n + 1) × k for the position, while the halves method effectively uses a different position for each half. The two can coincide on small data sets by chance, but the pattern doesn't hold across n values. Match your textbook method to your tool, not to whichever output looks familiar.