We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells Incorrectly Calculates AVERAGE


I have identified another bug in Cells. This one is a little easier to reproduce than my last (and hopefully easier to fix!).

The cells formula calculation engine appears to parse AVERAGE incorrectly.

To replicate this error:
1. Create a work book.
2. In cells A1:E1 enter the number 4
3. In cells F1:J1 enter the number 6
4. In cell A2 enter the formula [ =AVERAGE(A1:J1) ]

I’m sure you’ll agree unless I am going mad, the average of 4, 4, 4, 4, 4, 6, 6, 6, 6, 6 is 5. Excel agrees.

When I open the workbook in “cells” and return the value of cell A2 it gives me 5.

When I call CALCULATEFORMULA and then return the value of A2 I now get 6.25!!

My debugging code snippet is:
Public Function averageTest() As Double
Dim strResult As String

Dim wbk As Workbook = New Workbook
wbk.Settings.ParsingFormulaOnOpen = False

strResult = “PRE CALCULATE” & vbCrLf
strResult = strResult & "A2: " & wbk.Worksheets(0).Cells(“A2”).Value & vbCrLf & vbCrLf


strResult = strResult & “POST CALCULATE” & vbCrLf
strResult = strResult & "A2: " & wbk.Worksheets(0).Cells(“A2”).Value & vbCrLf & vbCrLf

Return strResult
End Function

I have also attached to workbook in question.


Hi Oli,

Thanks for pointing it out.

I can find the issue as you have mentioned using your template file.

We will figure it out soon.

Your issue has been logged into out issue tracking system with an issue id: CELLSNET-16677.

Thank you.


Please try the attached version, we have fixed your mentioned issue.

Thank you.

Thanks. I can’t test this at the moment but I will when we come to a new release in a couple of weeks.


The issues you have found earlier (filed as 16677) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

While trying to keep the API as straightforward and clear as possible, we have decided to recognize and honor the common development practices of the platform; we have re-arranged API Structure/ Namespaces.

With this release, we have reorganized the API classes for Aspose.Cells component. This change has some major aspects that we follow. We have added new namespaces. The entire API (classes, interfaces, enumerations, structures etc.) were previously located in the Aspose.Cells namespace. Now, certain sets of API have been moved to their relative namespaces, which make the relationship of classes (with their members) and namespaces clear and simplified. It is to be noted here, we have not renamed existing API (classes, enumerations etc.) but, I am afraid you still need to make certain adjustments in your existing projects accordingly.

For complete reference, please see the product's API Reference.