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

Getting Value from a cell has formula

Hi.. I tried to get a value from a cell that has a formula in (Xls file) but I couldn''t , is there a way to get value from this type of cell. e.g. : suppose the cell has this formula : =sum(A11:A:22) ant this cell has value (223) , I want to store this value in a variable. Thank you

4 Replies

AD Administrator Syncfusion Team October 22, 2004 06:58 AM

Hi Mohammmad, You can get the calculated value using IRange.FormulaNumberValue Code snippet -------------- IWorksheet mySheet = myWorkbook.Worksheets[0]; mySheet.Range["A1"].FormulaNumberValue Please let me know if you have any questions. Thanks. Best regards, Stephen. >Hi.. > > > I tried to get a value from a cell that has a formula in (Xls file) but I couldn''t , is there a way to get value from this type of cell. > >e.g. : suppose the cell has this formula : > >=sum(A11:A:22) >ant this cell has value (223) , I want to store this value in a variable. > >Thank you


AD Administrator Syncfusion Team October 23, 2004 03:28 AM

Sorry but it gives me 0 No run time error, here is the code: ----- Dim Formula as Double Dim sheet As IWorksheet = myWorkBook.Worksheets(0) Formula = sheet.Range(I, 2).FormulaNumberValue >Hi Mohammmad, > >You can get the calculated value using IRange.FormulaNumberValue > >Code snippet >-------------- > >IWorksheet mySheet = myWorkbook.Worksheets[0]; >mySheet.Range["A1"].FormulaNumberValue > >Please let me know if you have any questions. Thanks. > >Best regards, > >Stephen. > >>Hi.. >> >> >> I tried to get a value from a cell that has a formula in (Xls file) but I couldn''t , is there a way to get value from this type of cell. >> >>e.g. : suppose the cell has this formula : >> >>=sum(A11:A:22) >>ant this cell has value (223) , I want to store this value in a variable. >> >>Thank you


MA Mohammad Abdullah October 23, 2004 03:38 AM

Sorry but it gives me (0) No run time error, here is the code: ----- Dim Formula as Double Dim sheet As IWorksheet = myWorkBook.Worksheets(0) Formula = sheet.Range(I, 2).FormulaNumberValue >Hi Mohammmad, > >You can get the calculated value using IRange.FormulaNumberValue > >Code snippet >-------------- > >IWorksheet mySheet = myWorkbook.Worksheets[0]; >mySheet.Range["A1"].FormulaNumberValue > >Please let me know if you have any questions. Thanks. > >Best regards, > >Stephen. > >>Hi.. >> >> >> I tried to get a value from a cell that has a formula in (Xls file) but I couldn''t , is there a way to get value from this type of cell. >> >>e.g. : suppose the cell has this formula : >> >>=sum(A11:A:22) >>ant this cell has value (223) , I want to store this value in a variable. >> >>Thank you


GR Greg October 23, 2004 10:34 AM

In attempting to not make many assumptions: 1) The formula in the first example is incorrect - too many colons. I imagine that''s just a forum typo. 2) If Excel didn''t write that xls, then there is no calculated value. i.e. ExcelRW does not evaluate any formulas, neither in writing nor reading. Good Luck, Greg

Loader.
Live Chat Icon For mobile
Up arrow icon