Free Support Forum - aspose.com

SUM of #N/A

Hello,

I am still testing the release you sent me in post https://forum.aspose.com/t/106755

Now, I have other issues. Let's look at the following example. I am simulating a N/A in cell A1 (with a failing lookup), then I want to sum A1:A3 (in B3). In Excel, the result of this sum is N/A, but in Aspose, it is 5 (i.e. as if A1 equals 0).

Code Snipet:

Workbook wb = new Workbook();
Worksheet sheet=wb.getSheet(0);
Cell a1 =sheet.getCell("A1");
a1.setFormula("=MATCH(5,B1:B2,0)");
Cell a2 =sheet.getCell("A2");
a2.setValue(0);
Cell a3 =sheet.getCell("A3");
a3.setValue(5);
Cell b1 =sheet.getCell("B1");
b1.setValue(1);
Cell b2 =sheet.getCell("B2");
b2.setValue(2);
Cell b3 =sheet.getCell("B3");
b3.setFormula("=SUM(A1:A3)");
wb.calculateFormula();
System.out.println("A1="+a1.getValue());
System.out.println("B3="+b3.getValue());

Will provide the following output:

A1=#N/A

B3=5.0

What's your opinion on this matter ?

Thanks in advance,

Yann.

Hi,

Please try the fix in <A href="</A></P>