Closedxm iworksheet Excel Formeln
var totalBuldPlanCell = worksheet.Cell(rowIndex, 4);
var formulaString = new StringBuilder();
var shiftBuildPlanColumnOffset = 5;
for (var shiftCounter = 1; shiftCounter <= exportDataView.Shifts.Count; shiftCounter++)
{
var cellAddress = $"{worksheet.Cell(rowIndex, shiftBuildPlanColumnOffset).Address.ColumnLetter}{worksheet.Cell(rowIndex, shiftBuildPlanColumnOffset).Address.RowNumber}";
formulaString.Append(cellAddress);
if (shiftCounter < exportDataView.Shifts.Count)
{
formulaString.Append("+");
}
shiftBuildPlanColumnOffset += 3;
}
totalBuldPlanCell.FormulaA1 = formulaString.ToString();
totalBuldPlanCell.Style.Protection.SetLocked(true);
Aamir Farooq