TRIMRANGE
Remove blank outer rows or columns so the result fits the populated area.
Syntax
=TRIMRANGE(range, [trim_rows], [trim_cols])Worked example
Enter 7 in B2 and 9 in C3, leaving all other cells in A1:D5 empty. Put the formula outside that range. Only the occupied rectangle B2:C3 remains.
=TRIMRANGE(A1:D5)Result 2 rows × 2 columns
Microsoft documentation
Check the arguments, supported editions and behavior of this function in Microsoft’s reference.
Microsoft referenceDot Operator will CHANGE how you Write Formulas in Excel | TRIMRANGE Function
Practice TRIMRANGE
Remove the empty outer rows and columns of A1:D5.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 |
Show example formula
=TRIMRANGE(A1:D5) Lesson quiz
Answer three questions to see your level in this lesson.
