How to Find Quartiles in Even and Odd Length Datasets


Quartiles are values that split up a dataset into four equal parts.

To find the first and third quartile for a dataset with an even number of values, use the following steps:

  • Identify the median value (the average of the two middle values)
  • Split dataset in half at the median
  • Q1 is the median value in the lower half of the dataset (not including median)
  • Q3 is the median value in the upper half of the dataset (not including median)

To find the first and third quartile for a dataset with an odd number of values, use the following steps:

  • Identify the median value (the middle value)
  • Split dataset in half at the median
  • Q1 is the median value in the lower half of the dataset (not including median)
  • Q3 is the median value in the upper half of the dataset (not including median)

The following examples show how to calculate quartiles for both types of datasets.

Note: When calculating quartiles, some formulas do include the median value. As noted by Wikipedia, there is actually no universal agreement on how to calculate quartiles for discrete distributions. The formulas shared here are used by TI-84 calculators, which is why we have chosen to use them.

Example 1: Calculate Quartiles for Even Length Dataset

Suppose we have the following dataset with ten values:

Data: 3, 3, 6, 8, 10, 14, 16, 16, 19, 24

The median value is the average of the middle two values, which is (10 + 14) / 2 = 12.

We will not include this median value when calculating the quartiles.

The first quartile is the median of the lower half of values, which turns out to be 6:

Q1 = 3, 3, 6, 8, 10

The third quartile is the median of the upper half of values, which turns out to be 16:

Q3 = 14, 16, 16, 19, 24

Thus, the first and third quartiles for this dataset are 6 and 16, respectively.

Example 2: Calculate Quartiles for Odd Length Dataset

Suppose we have the following dataset with nine values:

Data: 3, 3, 6, 8, 10, 14, 16, 16, 19

The median value is the value located directly in the middle: 10.

We will not include this median value when calculating the quartiles.

The first quartile is the median of the lower half of values. Since there are two values in the middle, we will take the average which turns out to be (3 + 6) / 2 = 4.5:

Q1 = 3, 3, 6, 8

The third quartile is the median of the upper half of values. Since there are two values in the middle, we will take the average which turns out to be (16 + 16) / 2 = 16:

Q3 = 14, 16, 16, 19

Thus, the first and third quartiles for this dataset are 4.5 and 16, respectively.

Additional Resources

The following tutorials explain how to find the quartiles of a dataset using different statistical software:

How to Calculate Quartiles in Excel
How to Calculate Quartiles in R
How to Calculate Quartiles in SAS

3 Replies to “How to Find Quartiles in Even and Odd Length Datasets”

  1. I learned that Q1 is the lower and Q3 is the upper part of the data set. Also if you want to find Q1 and Q3 in a number line you have two different ways to to solve it depending if it is an odd number or even number.

  2. The results of Q1 and Q3 for the odd data set are different compared to the excel formula. It follows this formula: Divide the data set into two halves, a bottom half and a top half. If n is odd, include the median value in both halves. Then the lower quartile is the median of the bottom half and the upper quartile is the median of the top half.
    which one is correct?

    1. Hi Emma…To find quartiles in datasets, the process differs slightly depending on whether the dataset has an even or odd length. Here’s a step-by-step guide for both scenarios:

      ### Definitions
      – **Quartiles**: These are values that divide your dataset into four equal parts.
      – **Q1 (First Quartile)**: The median of the first half of the data.
      – **Q2 (Second Quartile/Median)**: The median of the entire dataset.
      – **Q3 (Third Quartile)**: The median of the second half of the data.

      ### Steps to Find Quartiles

      #### For Even Length Datasets
      1. **Sort the Data**: Arrange the data in ascending order.
      2. **Find Q2 (Median)**:
      – If the dataset has \( n \) elements, the median is the average of the \(\frac{n}{2}\)th and \(\frac{n}{2} + 1\)th elements.
      3. **Divide the Dataset into Two Halves**:
      – First half: From the first element to the \(\frac{n}{2}\)th element.
      – Second half: From the \(\frac{n}{2} + 1\)th element to the last element.
      4. **Find Q1**:
      – Q1 is the median of the first half.
      5. **Find Q3**:
      – Q3 is the median of the second half.

      #### For Odd Length Datasets
      1. **Sort the Data**: Arrange the data in ascending order.
      2. **Find Q2 (Median)**:
      – If the dataset has \( n \) elements, the median is the \(\frac{n + 1}{2}\)th element.
      3. **Divide the Dataset into Two Halves**:
      – First half: From the first element to the \(\frac{n – 1}{2}\)th element.
      – Second half: From the \(\frac{n + 1}{2} + 1\)th element to the last element.
      4. **Find Q1**:
      – Q1 is the median of the first half.
      5. **Find Q3**:
      – Q3 is the median of the second half.

      ### Examples

      #### Even Length Dataset
      Suppose the dataset is: [6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49, 50]

      1. **Sort the Data**: It is already sorted.
      2. **Find Q2 (Median)**:
      – \( n = 12 \)
      – Median (Q2) = Average of the 6th and 7th elements = \(\frac{40 + 41}{2} = 40.5\)
      3. **Divide the Dataset**:
      – First half: [6, 7, 15, 36, 39, 40]
      – Second half: [41, 42, 43, 47, 49, 50]
      4. **Find Q1**:
      – Q1 = Median of [6, 7, 15, 36, 39, 40] = \(\frac{15 + 36}{2} = 25.5\)
      5. **Find Q3**:
      – Q3 = Median of [41, 42, 43, 47, 49, 50] = \(\frac{43 + 47}{2} = 45\)

      #### Odd Length Dataset
      Suppose the dataset is: [6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49]

      1. **Sort the Data**: It is already sorted.
      2. **Find Q2 (Median)**:
      – \( n = 11 \)
      – Median (Q2) = 6th element = 40
      3. **Divide the Dataset**:
      – First half: [6, 7, 15, 36, 39]
      – Second half: [41, 42, 43, 47, 49]
      4. **Find Q1**:
      – Q1 = Median of [6, 7, 15, 36, 39] = 15
      5. **Find Q3**:
      – Q3 = Median of [41, 42, 43, 47, 49] = 43

      ### Summary
      – **Even Length**: Calculate Q2 as the average of the middle two values, then find Q1 and Q3 as the medians of the lower and upper halves, respectively.
      – **Odd Length**: Calculate Q2 as the middle value, then find Q1 and Q3 as the medians of the lower and upper halves, excluding the median.

      This systematic approach ensures accurate calculation of quartiles for both even and odd length datasets.

Leave a Reply

Your email address will not be published. Required fields are marked *