Reputation: 275
I'd like to apply a formula to an entire column, even if I insert a new row, I need all cells from a certain column to have the formula in EPPLUS Core.
For exemple, I would like to apply a formula to the column C
.
So every cell in column C
(C1,C2,...,C999999
) will have the formula
Upvotes: 2
Views: 2503
Reputation: 161
Here I wanted to concatenate Column 'A' and Column 'C' and put the result in column 'B' for each row. example : formula of B10 = CONCATENATE(A10,C10)
This can be easily done with
worksheet.Cells[1, 2, 100, 2].FormulaR1C1 = "CONCATENATE( RC[-1] , RC[1] )";
Here Cells[1, 2, 100, 2]
means starting from row 1 in column 2 to row 100 in column 2.
RC[-1]
means one cell to left, RC[1]
means one cell to right.
Upvotes: 2
Reputation: 114
Define your range as a Table and then write your formula in that table.
Now even if you try to insert a new row, the table property will automatically insert the formula into that newly inserted cell of that table in that column.
Hope this Helps.
Upvotes: 0