Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Sumsq issue #615

Open
ghost opened this issue Feb 5, 2020 · 1 comment
Open

Sumsq issue #615

ghost opened this issue Feb 5, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 5, 2020

EEPlus v: 4.5.3.3

The cell C1 contains this formula "SQRT(SUMSQ(B1:B300000)/ COUNTA(B1:B300000))".
I'm trying to get C1 value after WS.Cells["C1"].Calculate() but I get following error:

=================================
Timestamp: 05/02/2020 17:48:55

Worksheet: test.csv
Address: C1
OfficeOpenXml.FormulaParsing.Exceptions.ExcelErrorValueException: #VALUE!
   at OfficeOpenXml.FormulaParsing.Excel.Functions.ExcelFunction.CheckForAndHandleExcelError(ICellInfo cell)
   at OfficeOpenXml.FormulaParsing.Excel.Functions.Math.Sumsq.Calculate(FunctionArgument arg, ParsingContext context, Boolean isInArray)
   at OfficeOpenXml.FormulaParsing.Excel.Functions.Math.Sumsq.Execute(IEnumerable`1 arguments, ParsingContext context)
   at OfficeOpenXml.FormulaParsing.ExpressionGraph.FunctionExpression.Compile()

=================================
Timestamp: 05/02/2020 17:48:55

Worksheet: test.csv
Address: C1
OfficeOpenXml.FormulaParsing.Exceptions.ExcelErrorValueException: #VALUE!
   at OfficeOpenXml.FormulaParsing.Excel.Functions.DoubleArgumentParser.Parse(Object obj)
   at OfficeOpenXml.FormulaParsing.Excel.Functions.ExcelFunction.ArgToDecimal(Object obj)

The formula in the cell is written without "=". if I open the file with excel after creation it's work.
I tried to use WS.Cells.Calculate(), the others formulas work but not that.
I tried to close and reopen the file, get value after Calculate() but the result is the same.

@swmal
Copy link
Collaborator

swmal commented Feb 8, 2020

Hi,

just a brief disclaimer: the bugs we are fixing now is in EPPlus 5, which has moved to another repo and is distributed under another license (see the readme file in the new repo).

In this case it is difficult to see what is going wrong without the underlying data. Somewhere during the calculation EPPlus seems to fail in converting one of the values in the ranges to a double. Since it seems to be during execution of the SUMSQ(B1:B300000) and the function throwing the exception is CheckForAndHandleExcelError the only thing I can say is that in one of these 300000 cells you have an error. Our implementation of Sumsq throws an exception if a cell within the range contains an error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant