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

Free Support Forum - aspose.com

Problem parsing formula

Trying to set the following formula into a cell using the Aspose API:

if(B10="Direct", B16, if(B10="CAPM", (B18+B20*B22)*(1-9999.99)+'FinTax Exp'!B10*(1-'FinTax Exp'!B18)*9999.99, 0))

results in the exception:

"Aspose.Cells.CellsException: Error in Cell: B12-Invalid formula:\"=if(B10=\"Direct\", B16, if(B10=\"CAPM\", (B18+B20*B22)*(1-9999.99)+'FinTax Exp'!B10*(1-'FinTax Exp'!B18)*9999.99, 0))\".\r\n at Aspose.Cells.੬.౭(Cell ஶ)\r\n at Aspose.Cells.Cell.set_Formula(String value)\r\n at Modelsheet.AsposeGenerator.AsposeGenerator.SetFormula(Object cell, String formula) in D:\\Devo\\ModelSheet\\Model\\Spreadsheet\\Aspose.cs:line 169\r\n at ModelSheet.Model.Spreadsheet.BasicExcelGenerator.OutputCell(GeneratorContext gcontext, Object contents, ITableSpec table, Int32 nrow, Int32 ncol) in D:\\Devo\\ModelSheet\\Model\\Spreadsheet\\ExcelBase.cs:line 316"

If I copy the formula to the clipboard and paste it into Excel it works fine.



Hi Howard,

Could you post your template file, it will help us to figure reproduce and figure out the issue soon.

Thank you.

Okay, here's a smaller version of the spreadsheet that demonstrates the problem. Note cell B4 (C4, etc.) on the Discount Rate tab. In the comment for those cell's you'll see the formula we try to set and the exception from Aspose.


Hi Howard,

Thanks again for your help. We have fixed it in the attached version. Please try it.