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 22, 2004 10:58 AM UTC
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 07:28 AM UTC
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 07:38 AM UTC
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 02:34 PM UTC
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