## The Problem

The range is another measure of how spread out the data are. Because it only uses two values, the largest and the smallest, the range is easy to calculate. It is also very unstable as an estimator of the population range. To illustrate calculating the range, assume that you collected the following 4 data values:

73, 6, 8, 32

Calculate the range of this sample.

## Your Answer

You got the correct answer of **67**. Congratulations!

Unfortunately, your answer was not correct. Either try again or click on “Show Solution” below to see how to obtain the correct answer.

## Assistance

Hide Solution

The sample range is the difference between the largest and the smallest values. The largest values is also called the maximum; the smallest, the minimum.

How to calculate the range with the data given above.
Step 1: | Calculate the maximum: | 73 |

Step 2: | Calculate the minimum: | 6 |

Step 3: | Calculate their difference: | 73 − 6 = 67 |

Hide the R Code

Copy and paste the following code into your R script window, then run it from there.

sample = c(73, 6, 8, 32)

diff(range(sample))

In the R output, the sample range is the number output by the script. **Note** that the R function `range`

calculates the minimum and maximum values. The function `diff`

just takes their difference, which calculates the range as we have defined it.

Hide the Excel Code

Copy and paste the following code into your Excel spreadsheet window, making sure your cursor is in `A1`

when you paste.

sample

73

6

8

32

=MAX(A2:A5)-MIN(A2:A5)

Note that there is no `RANGE`

function in Excel. The only way to calculate the range is to calculate the maximum and minimum values of the sample and take their difference.