TRIMRANGE function in Excel
Scans in from the edges of a range or array until it finds a non-blank cell (or value), it then excludes those blank rows or columns
=TRIMRANGE(range, [trim_rows], [trim_cols])TRIMRANGE syntax and parameters
Three arguments, one required.
- rangerangeRequired
The range (or array) to be trimmed
- trim_rowsnumberOptional
Determines which rows should be trimmed0 - None1 - Trims leading blank rows2 - Trims trailing blank rows3 - Trims both leading and trailing blank rows (default)
- trim_colsanyOptional
TRIMRANGE examples
Formulas you'll actually reuse.
Sort the used part of a padded range — no trailing blank rows in the spill:
=SORT(TRIMRANGE(A2:C1000), 3, -1)A whole-column reference cut down to its used rows (2 = trailing blanks only), ready for FILTER or UNIQUE:
=TRIMRANGE(A:C, 2)
TRIMRANGE in Google Sheets
No direct equivalent — here's the way around.
Try TRIMRANGE in the playground
Edit the example — nothing to install.
Preloaded with the TRIMRANGE formula from Example 1 — change anything and watch it respond.
TRIMRANGE errors
What they mean — and the fixes.
#VALUE!trim_rows and trim_cols accept only 0–3 (none, leading, trailing, both).
Related functions
More ways Excel gets this done.
- ADDRESSReturns a reference as text to a single cell in a worksheetLookupGoogle Sheets
- AREASReturns the number of areas in a referenceLookupNo Google Sheets equivalent
- CHOOSEChooses a value from a list of valuesLookupGoogle Sheets
- CHOOSECOLSReturns the specified columns from an arrayLookupGoogle Sheets
- CHOOSEROWSReturns the specified rows from an arrayLookupGoogle Sheets
- COLUMNReturns the column number of a referenceLookupGoogle Sheets