Skip to content

Trim reference operator

karlkallman edited this page May 28, 2026 · 1 revision

Trim reference operator in EPPlus

The trim ref operator can be used in Excel to trim empty rows and columns in a given range. In the Excel UI, the trim ref operator is used directly in the formula, but when inspecting the XML, these operators actually reference functions. There are three ways to use the operator in Excel.

Trim trailing rows and columns

In excel, the operator can be used like this to trim the trailing cells in a range reference: =A1:.E5

To be able to use the operator like in the example above in EPPlus, the _TRO_TRAILING function have to be used to achieve the same result.

sheet.Cells["F1"].Formula = "_TRO_TRAILING(A1:E5)";

Trim leading rows and columns

To trim leading empty cells in excel, the operator is used like this: =A1.:E5

In EPPLUS, use the _TRO_LEADING function.

sheet.Cells["F1"].Formula = "_TRO_LEADING(A1:E5)";

Trim leading and trailing rows and columns

To trim both leading and trailing rows in excel, the operator can be used like this: A1.:.E5

In EPPLUS, use the _TRO_ALL(A1:E5) function.

sheet.Cells["F1"].Formula = "_TRO_ALL(A1:E5)";

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally