Skip to content

Function prefixes

Jan Källman edited this page Jul 27, 2023 · 7 revisions

Some newer functions in Excel needs to have prefixes when added to the Formula property via EPPlus. The most common prefix is "_xlfn.". EPPlus will handle these attribute when calculating workbook that already contains these attributes (as the workbook most likely was created by Excel), but when you add your own formulas via EPPlus you need to be aware of this.

Here is an example:

sheet.Cells["A1"].Formula = "DAYS($B$1+1,H5)";
sheet.Calculate(); // this will result in a #NAME error in cell A1 when opened in Excel

The DAYS function is one of the functions that needs to have an _xlfn. prefix

sheet.Cells["A1"].Formula = "_xlfn.DAYS($B+1,H5)";
sheet.Calculate(); // this will work

We refer to Microsofts documentation on which functions that requires attributes. Here is one page that adresses this issue. A list of functions requiring prefix can be found here

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally