Excel TRIMRANGE Formula Generator

The range of cells you want to trim. This is the main input for the function.
Examples: A1:D10, Sheet1!B2:E15, NamedRange
Specifies which rows should be trimmed from the range.
Specifies which columns should be trimmed from the range.

A few examples of using TRIMRANGE function

Scenario Formula Remarks
Trimming a Large Range =TRIMRANGE(G:J) trims the range G:J, removing empty rows and columns, and returns the trimmed range as an array.
Counting Rows of Data =ROWS(TRIMRANGE(G:J)) counts the rows in the trimmed range G:J
Formula for Counting Rows Excluding Header =ROWS(DROP(TRIMRANGE(G:J),1))
Dynamic Sum Formula =SUM(TRIMRANGE(A1:A100)) sums the values in the trimmed range A1:A100
Trimming Trailing Rows =TRIMRANGE(A1:A100, 2)
Leading and Trailing Rows =TRIMRANGE(A1:A100, 3)
About TRIMRANGE

The TRIMRANGE function automatically removes empty rows and columns from a range of data. It returns a reference that adjusts dynamically. It's particularly useful for:

Note: TRIMRANGE only removes empty rows and columns from the outer edges of the range, not from within the data.