EPPlusSoftware / EPPlus

EPPlus-Excel spreadsheets for .NET
https://epplussoftware.com
Other
1.8k stars 273 forks source link

Ceiling with Vlookup #1022

Closed colbybhearn closed 1 year ago

colbybhearn commented 1 year ago

Consider a formula where the VLookup function to select the value of the significance parameter to the Ceiling function. When the Vlookup returns blank, Excel produces a 0 but EPPlus produces #Value! for the overall formula result.

I'll submit a PR to create a test for this.

Here's Excel versus EPPlus output (respectively) ceil-vlookup.xlsx image

image

colbybhearn commented 1 year ago

Here's the sandbox code for that example:

 public static void ceilVlookup()
 {
     string filepath = @"ceil-vlookup.xlsx";
     ExcelPackage.LicenseContext = LicenseContext.Commercial;
     using (var package = new ExcelPackage(new FileInfo(filepath)))
     {
             package.Workbook.Calculate();
             ExcelWorksheet sheet = package.Workbook.Worksheets["result"];
             ExcelRangeBase exportRange = sheet.Cells["A1:E24"];
             IExcelHtmlRangeExporter exporter = exportRange.CreateHtmlExporter();
             string Html = exporter.GetSinglePage();
             File.WriteAllText(@"ceil-vlookup.html", Html);
     }
 }
colbybhearn commented 1 year ago

I was advised to try Ceiling.Math as well, but the overall result was still #Value!

JanKallman commented 1 year ago

Ok, I'll add a fix for Ceiling.Math as well.

JanKallman commented 1 year ago

Look like we have the same issue on Floor and Floor.Math

JanKallman commented 1 year ago

Fixed in 6.2.9