Contact

TRIMMEAN in ONLYOFFICE: Trim Equal Tails Before Averaging

Statistical Intermediate ONLYOFFICE

Understand TRIMMEAN with small datasets, reconstructed arithmetic and exact-source input and error caveats.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

=TRIMMEAN(A2:A11,0.2) has the independent target 5.5 for the ten values below. The percent specifies the total fraction removed across both tails, not the fraction removed from each end.

Syntax

TRIMMEAN(array, percent)

Build an inspectable ten-value dataset

Create TrimData. Put Duration in A1 and enter numeric values 1,2,3,4,5,6,7,8,9,100 in A2:A11. These fictional durations have an ordinary mean of 14.5 because the final value is large. Keep the original range unchanged; trimming changes which observations enter the statistic, not the cells themselves.

Put Trim fraction in C1 and enter 0,0.1,0.2,0.3,0.4 in C2:C6. Enter =TRIMMEAN($A$2:$A$11,C2) in D2 and fill down to D6. Type fractions or percentages consistently: 20% is 0.2, not 20.

The even-count rule

The official reference requires a numeric dataset and a trim fraction from 0 inclusive to 1 exclusive. It rounds the requested number of exclusions down to an even count, then removes half from each sorted tail.

For n numeric observations and fraction p, the implementation computes floor(p×n), decreases that integer by 1 if it is odd, and divides by 2 to obtain the number removed at each end. This makes the result a step function of p for a fixed small dataset; nearby percentages can produce identical retained observations.

Reconstruct each result

Fraction Total removed Each tail Retained values Target
0 0 0 1 through 9,100 14.5
0.1 0 0 1 through 9,100 14.5
0.2 2 1 2 through 9 5.5
0.3 2 1 2 through 9 5.5
0.4 4 2 3 through 8 5.5

At p=0.3, the requested exclusion count is 3, rounded down to 2. The retained sum is 44 over 8 observations, so the result is 5.5. At p=0.4, the retained sum is 33 over 6 observations, again 5.5. These identical answers arise from this particular middle sequence, not a general invariant of trimming.

Advanced: ordering, ties and the median

The implementation sorts numeric values before trimming, so reordering the input records does not change these mathematical targets. Ties at a cut point still occupy individual positions: the function removes a count of observations, not every value tied at the boundary.

At p=0.8 with ten values, eight are removed and only 5 and 6 remain, giving 5.5. At p=0.9, floor(9) is reduced to 8 and the same pair remains. For an odd-sized dataset such as 1,2,3,4,100 with p=0.8, four are removed and only 3 remains. High trimming can approach the middle observation(s), but the routine is a trimmed mean, not a general median function.

Trimming both ends is symmetric in count, not in distance from the mean. It can remove a genuine low observation along with a high outlier. Choosing a trim fraction after seeing the desired result can distort an analysis; document the rule and retain the raw data. A robust summary does not establish that discarded observations are erroneous.

Types, empty selections and errors

Only numeric elements in the prepared range enter the sorted list, so text, booleans and blanks do not increase n. Numeric zero does increase n. If you replace a number with a text label, both the retained values and the exclusion count can change. Check a numeric count rather than assuming the height of a range is the sample size.

The source’s numeric-only inner filter also skips error cells within a prepared range, while a direct error argument is propagated before calculation. This can hide a broken observation. Keep error checks separate from the trimmed statistic rather than relying on skipped errors as data cleaning.

The fraction must satisfy 0≤p<1; =TRIMMEAN(A2:A11,1) and a negative fraction are source-predicted #NUM!. A dataset with no numeric values also returns #NUM!. A direct text or logical first argument returns #VALUE!, while a direct numeric first argument is wrapped into a one-element array. Consequently =TRIMMEAN(7,0.8) is source-predicted 7: the even-count rule removes nothing from one value.

These are bounded source observations, not a native evaluation or a promise of behavior for every imported array or mixed-type workbook. Keep count inputs and formatting explicit when reproducing the exercise.

Version, precision and verification

Checked October 18, 2026 against current official help and SDKJS tag v10.0.0.169, commit 3679e0375a758d7dc59d31337a45461be3525ed8. Introduction dates and a final supported-version endpoint are not established. Desktop Editors, Docs, mobile releases and imported files require separate compatibility checks.

Neither the ONLYOFFICE application nor its calculation engine was executed for this guide. The numerical targets are independently calculated mathematical values; code-path and error observations are manual source traces. They are not screenshots, displayed workbook results or promises of identical final digits. Use English function names and comma separators as shown, adapting separators to the editor’s locale.

Keep inputs and intermediate probabilities numeric and unrounded. Format the display rather than replacing values with rounded strings. These moderate scalar examples do not certify extreme-tail accuracy, unusual type coercion, array entry or dynamic spill. Model assumptions must be checked separately from arithmetic correctness.