Skip to content

Precision as Displayed

Mats Alm edited this page Nov 10, 2026 · 4 revisions

This page has moved. The current version of this page is at https://epplussoftware.com/docs/formulas-and-filters/formula-calculation/precision-as-displayed/. The EPPlus documentation is no longer updated in this wiki; please use the EPPlus guides and update your bookmarks.

From EPPlus version 7.3, Precision as Displayed is supported by setting the property ExcelWorkbook.FullPrecision to false.
When using Precision as Displayed, EPPlus rounds all numeric values according to the number format of the cell.
This affects both cell values and formula calculation results.

using (var p = new ExcelPackage())
{
    var ws = p.Workbook.Worksheets.Add("Sheet1");
    ws.Cells["A1"].Value = 123.456789;
    ws.Cells["A2"].Value = 987.654321;
    ws.Cells["A3"].Formula = "SUM(A1:A2)";
    ws.Cells["A1:A3"].Style.Numberformat.Format = "#,##0.00";
    p.Workbook.FullPrecision = false;  //This will round the values in A1 and A2 according to the number format "#,##0.00". 
    //Any changes to cells will also be rounded depending on the number format.

    ws.Calculate(); //Calculation results will also be rounded in the sane way.

    //Now the values in A1:A3 will be:
    Assert.AreEqual(123.46, ws.Cells["A1"].Value);
    Assert.AreEqual(987.65, ws.Cells["A2"].Value);
    Assert.AreEqual(1111.11D, ws.Cells["A3"].Value);
}

Using Precision as Displayed will obviously lower the precision, but can be helpful if you want to mimic the results shown in the spreadsheet application or to reduce floating point issues.

See also

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally

⌂ 换网址