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

Trimmed Mean Formula: How to Calculate It, With Examples

The trimmed mean formula explained: sort, cut k values from each end, average the rest. Worked example plus Excel, R and Python differences.

Written and maintained by CASRAI Editorial Board

Last updated

A trimmed mean is an average calculated after the most extreme values at both ends of a sorted dataset have been set aside. The trimmed mean formula is simple: sort the values, remove k observations from each end, and average the n − 2k values that remain. This guide gives the formula with every symbol explained, a worked example with the arithmetic shown, and a side-by-side table of how Excel, R and Python (SciPy) decide how many values to cut, because the same percentage does not mean the same thing in all three.

What Is a Trimmed Mean?

A trimmed mean (also called a truncated mean) is the arithmetic mean of the interior of a dataset. Microsoft’s documentation for the Excel TRIMMEAN function describes it as returning “the mean of the interior of a data set”. The idea is to keep the familiar mean while limiting the pull of a few unusually high or low observations. With no trimming it equals the ordinary mean. The more you trim, the less any single extreme value can move the result.

A trimmed mean differs from a winsorized mean in one respect: trimming discards the extreme values, while winsorizing replaces them with the nearest retained value, so the sample size does not change. For the wider family of summary measures, see descriptive statistics.

Trimmed Mean Formula

Let x(1) ≤ x(2) ≤ … ≤ x(n) be the n observations sorted from smallest to largest. Choose a trimming proportion p to cut from each end. Then:

k = ⌊p × n⌋

Trimmed mean = ( x(k+1) + x(k+2) + … + x(n−k) ) / ( n − 2k )

  • n: the number of observations.
  • p: the proportion trimmed from each end, between 0 and 0.5 (for example, 0.1 trims 10% from the bottom and 10% from the top).
  • k: the number of values removed from each end. ⌊ ⌋ means rounding down to a whole number.
  • x(i): the i-th smallest value after sorting.
  • n − 2k: the number of values left to average, which is also the divisor.

The SciPy documentation for scipy.stats.trim_mean states that the number of elements to trim is rounded down. SciPy’s own example shows how that plays out: for the four values 1, 2, 3, 5 with a proportion of 0.25, one value is cut from each end and the result is 2.5, the mean of 2 and 3. With a proportion of 0.24999, the product 0.24999 × 4 is below 1, so k = 0 and nothing is trimmed: the result equals the ordinary mean.

Trimmed Mean Worked Example

Ten response times, in seconds, listed in the order collected: 41, 3, 7, 5, 9, 4, 6, 8, 5, 7.

  1. Sort: 3, 4, 5, 5, 6, 7, 7, 8, 9, 41.
  2. Choose p = 0.1. Then k = ⌊0.1 × 10⌋ = 1, so one value comes off each end: the 3 and the 41.
  3. Add the remaining eight values: 4 + 5 + 5 + 6 + 7 + 7 + 8 + 9 = 51.
  4. Divide by n − 2k = 8: 51 / 8 = 6.375.

For comparison, the ordinary mean is (3 + 4 + 5 + 5 + 6 + 7 + 7 + 8 + 9 + 41) / 10 = 95 / 10 = 9.5, and the median is (6 + 7) / 2 = 6.5. The single value 41 pulls the mean 3 seconds above the median; the 10% trimmed mean stays close to the median.

With p = 0.2, k = 2 and the two lowest (3, 4) and two highest (9, 41) values come off. The remaining six values sum to 5 + 5 + 6 + 7 + 7 + 8 = 38, and 38 / 6 ≈ 6.333.

Trimmed Mean Examples in Excel, R and Python

Each snippet reproduces the 10% trimmed mean above (6.375). Put the ten values in cells A2:A11 for Excel.

Excel (note that the argument is the total share excluded, so 0.2 here):

=TRIMMEAN(A2:A11, 0.2)

R (trim is the fraction cut from each end):

x <- c(41, 3, 7, 5, 9, 4, 6, 8, 5, 7)
mean(x, trim = 0.1)

Python (proportion cut from each end):

from scipy import stats
x = [41, 3, 7, 5, 9, 4, 6, 8, 5, 7]
stats.trim_mean(x, 0.1)

Excel, R and SciPy Do Not Use the Same Convention

This is the most common source of mismatched answers. The R documentation for mean defines trim as “the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed”, and SciPy’s proportiontocut is likewise the fraction removed from the most positive and the most negative elements. Excel’s TRIMMEAN works differently: its percent is the share of data points excluded in total, and the documentation says it “rounds the number of excluded data points down to the nearest multiple of 2”, so exclusions come in pairs, one from each end.

Setting Excel TRIMMEAN R mean(trim=) SciPy trim_mean
What the argument means Total share excluded (both ends combined) Fraction cut from each end Fraction cut from each end
Value 0.2 on the 10 values above 2 excluded in total, 1 per end: 6.375 2 per end: 6.333 2 per end: 6.333
Equivalent of 1 value cut per end 0.2 0.1 0.1

In the second row, 0.2 × 10 = 2 values in total for Excel (one per end) and 0.2 × 10 = 2 values per end for R and SciPy. Because the conventions differ, always state which one you used.

Interpreting a Trimmed Mean

Read the trimmed mean next to the ordinary mean and the median. The comparison tells you how much the tails are influencing the average.

What you see What it tells you
Trimmed mean ≈ mean The removed values were not pulling the mean much in either direction.
Trimmed mean well below the mean High extreme values were inflating the mean. In the example, 6.375 against 9.5.
Trimmed mean well above the mean Low extreme values were dragging the mean down.
Trimmed mean ≈ median The interior of the data is roughly balanced. In the example, 6.375 against 6.5.

A large gap between mean and trimmed mean is also a prompt to look at the shape of the distribution: see skewness and the five-number summary for other ways to describe it.

Assumptions and Common Mistakes

  • Mixing conventions. Using 0.2 in Excel and 0.2 in R or SciPy gives different trimming. Match the per-end or total definition to the tool.
  • Forgetting the rounding. Because k is rounded down, small samples with small proportions may trim nothing. In SciPy’s example, 0.24999 on four values trims zero observations and returns the plain mean. With n = 10 and p = 0.05, k = ⌊0.5⌋ = 0.
  • Dividing by n instead of n − 2k. The divisor is the number of values kept.
  • Trimming unsorted data. Sort first. Cutting the first and last entries of data in collection order is not trimming.
  • Choosing p after seeing the result. Fix the trimming proportion before looking at the outcome; the trimming versus winsorizing guide covers why picking an outlier-handling method after seeing the result is a methodological risk.
  • Treating it as deletion. The trimmed mean is a summary. The original data stay in the dataset.

How to Report a Trimmed Mean

Readers cannot reproduce your figure unless you give the trimming rule, because the proportion alone is ambiguous across software. A report line in a typical journal style, using the worked example, is:

The 10% trimmed mean response time (10% removed from each end, n = 10, 8 values retained) was 6.38 s, compared with an untrimmed mean of 9.50 s.

State the proportion per end, the original and retained sample sizes, and the software function. Report the untrimmed mean as well, so the effect of the extreme values is visible. Consult your target journal or style manual for its rules on rounding and statistical symbols.

Trimmed Mean FAQ

What is a trimmed mean?

It is the average of a dataset after a fixed share of the lowest and highest values has been removed. It limits the influence of extreme observations while still using most of the data.

What is the formula for the trimmed mean?

Sort the data, remove k = ⌊p × n⌋ values from each end, then add the remaining values and divide by n − 2k.

What percentage should I trim?

The software documentation does not prescribe one; R accepts any fraction from 0 to 0.5 per end. Choose the proportion before analysis, justify it, and report it. A fixed rule chosen in advance is easier to defend than one tuned to the result.

Is a trimmed mean the same as a winsorized mean?

No. Trimming drops the extreme values and shrinks the sample; winsorizing replaces them and keeps n unchanged.

Why does Excel give a different trimmed mean than R or Python?

Excel’s percent is the total share excluded, split between the two ends, while R and SciPy take the fraction cut from each end. Halve the Excel figure, or double the R and SciPy figure, to compare them.

Sources

Checked 2026-10-29.

Follow CASRAI

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

Ask CASRAI · free to try

Ask about Trimmed Mean Formula: How to Calculate It, With Examples

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.