Getting absolute value of a range not working

We often have a need to give a cell a formula that calculates the weighted average of a group of cells. To do this in excel we would often write a formula that looks like the one you will see in the code example below.

 Dim wb As New Workbook
Dim ws As Worksheet = wb.Worksheets(0)

ws.Cells("A1").PutValue("Volume")
ws.Cells("A2").PutValue(6)
ws.Cells("A3").PutValue(-2)

ws.Cells("B1").PutValue("Price")
ws.Cells("B2").PutValue(2.0)
ws.Cells("B3").PutValue(1.0)

ws.Cells("A6").PutValue("Weighted Average Price")
ws.Cells("B6").Formula = "=sumproduct(abs(A2:A3),B2:B3)/sumproduct(abs(A2:A3))"

wb.CalculateFormula()

'Cell B6 where the formula is, now has a value of "#VALUE!"
'The value actually should be "1.75"
Excel will calculate this correctly but we need it to be calculated correctly with Aspose so that we can save it as an HTML file.
Can this be corrected, or is there some other way that we can write this formula to achieve the same result?

Thanks,
-Josh Lupo

Hi,

Thanks for providing us sample code with details.

We found the issue regarding calculating the values for the function(s) after an initial test, we will look into it and get back to you soon.

Thank you.

Hi,

Please try the attached version, we have fixed the issue regarding formula(s).

Thank you.

The attached version works great, thanks a lot.


-Josh Lupo

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


This message was posted using Notification2Forum from Downloads module by Amjad Sahi.