Here's how to calculate the IQR:
Steps:

Order your data set: Arrange your data points from the smallest value to the largest value.

Find the median (Q2):

If you have an odd number of data points, the median is the middle value.

If you have an even number of data points, the median is the average of the two middle values.

Find the first quartile (Q1):

This represents the middle value of the lower half of your data set.

If you have an odd number of data points, Q1 is the value exactly halfway between the first element (smallest value) and the median (Q2).

If you have an even number of data points, Q1 is the median of the lower half of the data set (excluding the median itself).

Find the third quartile (Q3):

This represents the middle value of the upper half of your data set.

If you have an odd number of data points, Q3 is the value exactly halfway between the median (Q2) and the last element (largest value).

If you have an even number of data points, Q3 is the median of the upper half of the data set (excluding the median itself).

Calculate the IQR:
Formula:
The IQR can also be calculated using the formula:
where:

Q3 is the third quartile (upper quartile)

Q1 is the first quartile (lower quartile)
Example:
Let's say you have the following data set:
{2, 5, 7, 9, 11, 13, 15, 17}

Ordered data set: {2, 5, 7, 9, 11, 13, 15, 17}

Median (Q2): Since we have an even number of data points, the median is the average of the two middle values ((9 + 11) / 2) = 10.

First quartile (Q1): Q1 is the median of the lower half (excluding the median): {2, 5, 7, 9}. So, Q1 = 7.

Third quartile (Q3): Q3 is the median of the upper half (excluding the median): {11, 13, 15, 17}. So, Q3 = 13.

IQR: IQR = Q3  Q1 = 13  7 = 6.
Therefore, the interquartile range (IQR) for this data set is 6.
Interpretation:
The IQR tells you that the middle 50% of the data points fall within a range of 6 units (from 7 to 13). In other words, the IQR is a measure of variability within the central portion of your data set.