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

How to create excel formula

Hi,
I am try to create excel formula.
I am using following code.

ExcelEngine oengine = new ExcelEngine();
IApplication oApp = oengine.Excel;
oApp.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook oWorkbook  =  oApp.Workbooks.Create(1);
IWorksheets osheets = oWorkbook.Worksheets;
IWorksheet  osheet = osheets .Worksheets[0];

IRange oRange = osheet .Range["A2:A25"];
oRange.FormulaR1C1 = "R[-1]C+1";

IRange oRange = osheet .Range["L4"];
oRange.FormulaR1C1 = "R[-1]C+1";

A2 to A25 cell value is right but L4 to L13 cell show null value using this method.

How to create shared formula from A2 to A25 cell range and L4 to L13 cell range with single Technique.
Excel file is attach with mail.

Attachment: normaldatacheck_608d184e.rar

3 Replies

AV Abirami Varadharajan Syncfusion Team September 15, 2016 01:00 PM UTC

Hi Sharad, 
  
Thank you for contacting Syncfusion support. 
  
We are unable to reproduce the issue and we have prepared a sample to achieve the shared formula for the ranges A2:A25 and L4:L13, which can be downloaded from following location. 
  
  
Kindly refer and let us know if it satisfies your requirement. 
  
Regards, 
Abirami. 



SK Sharad Kumar September 16, 2016 02:51 AM UTC

Hi,

Thanks you your replay.
In this file , Cell range L4 to L13 have a formula.
formula value is  = "=IF(K4="","",K4/SUM($K$4:$K$1048576)+L3)"
In given your example formula value is not define .
Orignal Excel file is attach with mail.

Thanks

Attachment: 6paretoanalysischartexceltemplate_c0b31990.rar


AV Abirami Varadharajan Syncfusion Team September 19, 2016 12:20 PM UTC

Hi Sharad, 
  
We suggest to set the shared formula to range L5:L13. The error value is shown in range L4:L13, since 1 is added to string value “Cumulative %”. Kindly refer below code snippet to achieve this. 
  
Code Snippet: 
IRange range = worksheet.Range["L5:L13"]; 
range.FormulaR1C1 = "R[-1]C+1"; 
  
We have also shared sample for your reference which can be downloaded from following location. 
  
  
Kindly refer and let us know if it your requirement is achieved. 
  
Regards, 
Abirami. 


Loader.
Up arrow icon