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. Image for the cookie policy date

Reading cells with formulas

Hi! Is there a way to get the value from a cell that contains a formula? var = ws.Range(r, c).Value "var" gets the formula as a string or I get an error. Thanks for your help.

1 Reply

AD Administrator Syncfusion Team April 19, 2006 03:27 PM UTC

Hi Fmedina, Sorry for the delay in getting you. The code var = ws.Range(r, c).Value gives Formula string,as the Value property gets or sets the variant and not the number value. The error while using the above code may occur if XlsIO doesnot support that particular formula. Here is the code to read the value from a cell that contains formula. string str=sheet.Range["A3"].FormulaNumberValue.ToString() Please see the attachment and let me know if you need any further assistance. ReadFormulaValue.zip BestRegards, Bharath

Loader.
Live Chat Icon For mobile
Up arrow icon