I am creating an Excel file using C#.
The end result should be:
Excel workbook with 5 sheets
1 sheet is generated using other 4 sheets.
4 sheets are generated from database
All the formulas should be added to sheet 1 just in case the user wants to add data manually to other 4 sheets
I am stuck at:
After I create all the 4 sheets, I am trying to add formulae to sheet 1.
Formula Logic - Look for value of column A (all rows one by one) of sheet 1 (current) in sheet 2's column A, and get the value of column K of that row.
I am trying to add the below VLOOKUP to the 12th row and will copy the formula to all rows.
oRng = worksheet.Range["J12"];
oRng.FormulaR1C1 = "=IF(ISERROR(VLOOKUP(RC[-9],'Sheet2'!$A:$K,11,0)),'',VLOOKUP(RC[-9],'Sheet2'!$A:$K,11,0)";
But I get the error:
Exception from HRESULT: 0x800A03EC