Skip to main content
v2026.11,858 entries · CC-BY 4.0

How to Calculate the Midrange: Formula, Worked Example and Code

Midrange = (minimum + maximum) / 2. Worked example with arithmetic, why one outlier moves it, and Excel, R and Python code.

Written and maintained by CASRAI Editorial Board

Last updated

The midrange is the value halfway between the smallest and the largest observation in a data set. To calculate it, add the minimum and the maximum and divide by 2. This guide gives the formula, a worked example with the arithmetic shown, what the result does and does not tell you, and copy-ready Excel, R and Python code.

What is the midrange?

The midrange (also written mid-range) is a measure of location, like the mean and the median. The NIST/SEMATECH e-Handbook of Statistical Methods defines it as “(smallest + largest)/2”. Because it uses only the two most extreme values, every other observation is ignored. It is therefore a quick summary of where the extremes sit, not of where most of the data sit. It is not a substitute for the descriptive statistics you would normally report first.

Midrange formula

The midrange formula is:

Midrange = (xmin + xmax) / 2

  • xmin is the smallest value in the data set.
  • xmax is the largest value in the data set.
  • The division by 2 turns the sum of the two extremes into their average, which is the point exactly halfway between them.

The data do not need to be sorted first; you only need to identify the minimum and the maximum.

How to calculate the midrange step by step

To calculate the midrange: (1) find the minimum, (2) find the maximum, (3) add them, (4) divide by 2.

Worked example

Ten scores: 12, 15, 18, 20, 21, 23, 25, 27, 30, 34.

  1. Minimum = 12.
  2. Maximum = 34.
  3. Sum of the extremes = 12 + 34 = 46.
  4. Midrange = 46 / 2 = 23.

For comparison, the sum of all ten scores is 12 + 15 + 18 + 20 + 21 + 23 + 25 + 27 + 30 + 34 = 225, so the mean is 225 / 10 = 22.5. The median is the average of the 5th and 6th ordered values, (21 + 23) / 2 = 22. Here the three measures are close because no value is far from the others.

Is the midrange robust to outliers?

No. NIST states that “the mid-range, since it is based on the two most extreme points, is not robust,” and that “its use is typically restricted to situations in which the behavior at the extreme points is relevant.” The example below shows why.

Add one extreme score, 120, to the ten scores above (n = 11):

  • Minimum = 12, maximum = 120, so the midrange = (12 + 120) / 2 = 132 / 2 = 66.
  • Sum = 225 + 120 = 345, so the mean = 345 / 11 = 31.4 (31.36 to two decimals).
  • Ordered values: 12, 15, 18, 20, 21, 23, 25, 27, 30, 34, 120. The median is the 6th value, 23.
Measure Original 10 scores With one added score of 120 Change
Midrange 23 66 +43
Mean 22.5 31.36 +8.86
Median 22 23 +1

One added value moved the midrange by 43 points, the mean by about 9 and the median by 1. If a single extreme value can do this, the midrange should not be your only summary. For the median and the spread around it, see median and interquartile range and the five-number summary. If extreme values are a concern, winsorizing versus trimming explains two ways of limiting their influence.

How to read the result

Situation What the midrange tells you
You care about the extremes themselves It is the point halfway between the lowest and highest value (NIST: use is typically restricted to cases where behavior at the extremes is relevant).
The data contain one very large or very small value It moves with that value; in the example above one added score shifted it from 23 to 66.
You want the typical value Use the mean or median instead; both use more of the data than just two points.

A single extreme value can pull the midrange away from the bulk of the data. To recognise lopsided distributions, see left-skewed versus right-skewed distributions.

Assumptions and common mistakes

  • Confusing the midrange with the median. NIST defines the median as the value with half the data smaller and half larger. The midrange is the midpoint of the two extremes. In the example above they were 23 and 22; with the outlier they were 66 and 23.
  • Confusing the midrange with the range. The range describes spread (largest minus smallest); the midrange describes a location (their average). If you are building grouped tables, see how to calculate class width.
  • Using the midrange as the only summary. It ignores every value except two, so always report it alongside the minimum and maximum, or use a more robust measure.
  • Letting missing values slip in. In Excel, MAX ignores empty cells, logical values and text in a reference, so a text entry such as “n/a” is silently skipped. In R, range() has the argument na.rm (default FALSE), a logical indicating whether NA values should be omitted, so set na.rm = TRUE when your data contain NAs.
  • Using diff(range(x)) in R. R’s range() returns the minimum and the maximum, not their difference, and diff() of that is the sample range, not the midrange.

How to report the midrange

Report the midrange together with the values it is built from and the sample size, so readers can judge how much the extremes drive it. For the worked example:

The midrange of the scores was 23 (minimum = 12, maximum = 34, n = 10).

State why you used it (for example, because the extreme values are of interest) and, if you also computed the mean and median, give them in the same sentence or table.

How to calculate the midrange in Excel, R and Python

Excel

With the data in cells A2:A11, add the largest and smallest values and divide by 2. MAX takes the form MAX(number1, [number2], …) and MIN is its counterpart.

=(MAX(A2:A11)+MIN(A2:A11))/2

R

range() returns the minimum and maximum, so taking the mean of those two numbers gives the midrange:

x <- c(12, 15, 18, 20, 21, 23, 25, 27, 30, 34)
mean(range(x, na.rm = TRUE))
# 23

Python

Plain arithmetic with the built-in min() and max() is enough:

x = [12, 15, 18, 20, 21, 23, 25, 27, 30, 34]
midrange = (min(x) + max(x)) / 2
print(midrange)  # 23.0

FAQ

How to calculate midrange?

Find the smallest and largest values, add them, and divide by 2. For the scores 12, 15, 18, 20, 21, 23, 25, 27, 30 and 34, the midrange is (12 + 34) / 2 = 23.

What is the midrange formula?

Midrange = (minimum + maximum) / 2, the same as the NIST definition “(smallest + largest)/2”.

Is the midrange the same as the median?

No. The median is the middle value of the ordered data; the midrange is the midpoint of the two extremes. They can coincide, but they usually differ, and the midrange changes much more when an outlier is added.

When should I use the midrange?

NIST says its use is typically restricted to situations in which the behavior at the extreme points is relevant. Otherwise the mean or median is the more usual measure of location.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about How to Calculate the Midrange: Formula, Worked Example and Code

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Ask CASRAI · Regulatory Radar

Research-admin question? Get an answer that links its sources.

An AI assistant specialized in research administration. Every answer links its sources to check before you act. 2 questions free, no account. $29/month after.

  • Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.
  • Every answer numbers its sources and links each one, so you can check the source yourself.