Free Support Forum -

Calculation error : invalid cast

Hi Aspose team,

I received an invalid cast error, how can i solve the problem?

cell formula

=IF(MAX(C25:J25)-C25=0;C25;C25&" to "&MAX(D25:J25))

I sent the file by mail.

thanks for your help.


Please replace the ';' with ','.

I tried the following code using a sample template file and it works fine:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Aspose.Cells.Cell cell = worksheet.Cells[0, 1];
cell.Formula = "=IF(MAX(C25:J25)-C25=0,C25,C25& \" to \"&MAX(D25:J25))";
MessageBox.Show(cell.StringValue); // gives the correct value.

Which version you are using? Please try the latest version.

Thank you.

I test with your file and don’t find the problem. Maybe it’s a bug in old versions. Please try this attached version.