private static void CountLastStroke(IExcelService excel, int startRow, int iRow, decimal oldFinalPrice) { excel.SetCells(iRow, "G", string.Format("=SUM(G{0}:G{1})", startRow, (iRow - 1))); excel.SetCells(iRow, "H", string.Format("=G{0}-F{1}*E{2}", iRow, iRow, iRow)); excel.SetCells(iRow, "N", string.Format("=SUM(N{0}:N{1})", startRow, iRow - 1)); excel.SetCells(iRow, "O", string.Format("=N{0}-F{1}*E{2}", iRow, iRow, iRow)); excel.SetCells(iRow, "P", string.Format("=G{0}-N{1}", iRow, iRow)); excel.SetCells(iRow, "Q", string.Format("=P{0}/G{1}", iRow, iRow)); if (excel.GetCell(iRow, "N") == "0" || excel.GetCell(iRow, "N") == "-") { excel.SetCells(iRow, "N", oldFinalPrice); } }