Skip to main content
← All functions

TRIMRANGE function

Exclude blank outer rows or columns from a range.

Remove genuinely empty outer rows and columns while retaining interior blanks and numeric zeroes. Row and column options are 0 (none), 1 (leading), 2 (trailing), or 3 (both, the default). The local example covers the function form; separate trim-reference syntax is not implemented. Native Excel requires a supported Microsoft 365 build.

Syntax

TRIMRANGE(range, [trim_rows], [trim_cols])

Square brackets indicate optional arguments.

Arguments

ArgumentRequiredMeaning
rangeYesThe rectangular input range whose outer empty area is removed.
trim_rowsNoControls which blank outer rows are excluded.
trim_colsNoControls which blank outer columns are excluded.

Try TRIMRANGE

Remove outer blanks while retaining an internal blank row

=LET(trimmed,TRIMRANGE(A2:C6),IF(ISBLANK(trimmed),"",trimmed))

Only completely empty outer rows and columns are trimmed. The all-blank row between the two data rows remains; IF(ISBLANK(...),"",...) displays those interior blanks as empty text while preserving the real numeric zero. Defaults trim both leading and trailing edges. A formula returning empty text is not a genuinely empty cell. TRIMRANGE requires a supported Microsoft 365 build.

Inspect the current formula

Read its written arguments or observe actual operation values in a separate local calculation. This action neither applies a draft nor grades an answer.

Read the formula, one argument at a time

Explore the written function calls and their inputs. The calculation result belongs to the complete formula.

TRIMRANGE · inside LET

=LET(trimmed,TRIMRANGE(A2:C6),IF(ISBLANK(trimmed),"",trimmed))

1 / 1 · range

The rectangular input range whose outer empty area is removed.

TRIMRANGE reference ↗

Follow the cells behind a result

Read explicit local references and helper formulas using a separate calculation. Your draft stays in this field; the worksheet and practice checks do not change.

The worksheet runs locally. Published checks apply to the supplied example only. Native Excel and Google Sheets compatibility remain unverified.

Reference and compatibility

Original SheetTutor reference notes / Microsoft documentation. Calculation checks cover the supplied examples only. The browser worksheet does not implement every Excel feature, external service or connected data type.