Free Support Forum - aspose.com

Formula Value

This is going to be hard to explain, but I have a formula in a cell of =SUM(B98:C98) and I'm getting a value of zero.

B98 and C98 both have values greater than zero.

The hard part is I have a lot of styles and celllocks and protection, etc.

I ran a test on a different form where I just populated 2 cells with values and a 3rd cell with a formula and that worked fine.

So, obviously the formulas do work, but for some reason, in my app, it's not...any ideas?

this is Aspose.Grid.Desktop 1.9.4.2

Hi,

Thanks for considering Aspose.

Well, I don't find any problem using your formula, Could you create a sample test project, zip it and post it here to show the issue. We will check it soon.

Thank you.

I think the issue is when I'm setting the cell.Value property, my values are strings. Sometimes the value is a number and sometimes it is text.

I'm setting the style on the cell to have a numericformat of 3, but it doesn't help.

Hi,

Well, the behaviour is same as MS Excel. I think you can convert the types while inserting data to the cells. The following code will work.

E.g.,

Dim sheet As Aspose.Grid.Desktop.Worksheet = Me.ActiveGridDesktop.GetActiveWorksheet()
Dim cells As CellCollection = sheet.Cells
cells("C98").Value = CType("10", Integer)
cells("D98").Value = CType("20", Integer)
cells("E98").Value = "=Sum(C98:D98)"

Thank you.