We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Evaluating formula

Thread ID:





76315 Sep 1,2008 09:13 AM Sep 8,2008 09:40 AM Windows Forms 3
Tags: XlsIO
Simon Olesen
Asked On September 1, 2008 09:13 AM

i have a problem evaluating a formula from a cell, with a value:


i read a few other posts on the forum:

suggesting that the solution was sheet.Range[cellId].FormulaNumberValue.ToString() - but this returns "0" for me, and from what i can gather from another post on the forum (which i unfortunetly lost the link to), this is because that there is no value, because the sheet was created using XlsIO and have not yet been opened and saved by Excel - i tried opening and saving the sheet, and then it worked. but what do i do when i want to have the values calculated by formulas created in XlsIO ??


Geetha M [Syncfusion]
Replied On September 2, 2008 07:22 AM

Hi Simon,

Thank you for your interest in Syncfusion products.

Essential XlsIO does not have a calculate engine to evaluate formulas. Alternatively, you can make use of Essential Calculate to evaluate formulas. I have created a sample doing simple addition using Essential Calculate and you can download it from your in the following link:


Further, I strongly recommend you to go through the ComputeSpecificFormula and ComputeAllFormulas samples that ships with our Essential XlsIO package.

MyDocuments\Syncfusion\EssentialStudio\{version number}\Windows\XlsIO.Windows\Samples\2.0\DataManagement\ComputeAllFormulas\

MyDocuments\Syncfusion\EssentialStudio\{version number}\Windows\XlsIO.Windows\Samples\2.0\DataManagement\ComputeSpecificFormula\

Please let me know if you have any questions.


Simon Olesen
Replied On September 3, 2008 08:29 AM

The ComputeAllFormulas example seemed to be exactly what i needed, but i get an error when calculating "=VLOOKUP(X3,Ark1!A2:C103,2,False)".

I have attached my example, i hope you can help clearify what i am doing wrong here.

Thanks in advance,


Geetha M [Syncfusion]
Replied On September 8, 2008 09:40 AM

Hi Simon,

I was not able to reproduce the problem with "=VLOOKUP(X3,Ark1!A2:C103,2,False)" rather I got the below exception when ='1055'!A16 was refreshed.

System.FormatException was caught
Message="Input string was not in a correct format."
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.Double.Parse(String s)
at SDAResumeToCSV.XlsIOCalcSheet.SetValueRowCol(Object value, Int32 row, Int32 col) in

I modified the code snippet in the SetValueRowCol method in the XlsIOCalcWorkbook.cs which previously was trying to convert the text to double.

Modified code:
Double temp = 0; string temp1 = string.Empty;
temp = Double.Parse(value.ToString());
catch (System.FormatException)
excelSheet[row, col].FormulaStringValue = value.ToString();
excelSheet[row, col].FormulaNumberValue = temp;

And now the sample works fine. Could you please let me know what kind of issue you encounter with the VLOOKUP formula?



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.