title: invoke formula in excel via epplus
body: <p>I have an excel sheet in ASP.NET MVC4 C# project and I am able to read from excel sheet successfully using EPPlus. Now, I want to be able to pass in 2 numbers into cell C:2 and C:3 and be able to invoke formula in C:4 which is =SUM(C2:C3). </p>
  
  <p>So from C# I want to pass in 4 and 6 and invoke the formula and be able to get the result back from C:4 which is 40 (SUM of 10 and 30). How do I accomplish that in C#. </p>
  
  <p>In the following code, I get back zero for d.Average</p>
  
  <pre><code>d.Average = Convert.ToDouble(currentWorksheet.Cells["C4"].Value);
  </code></pre>
  
  <p>Here is my following code in c# so far to traverse a row.</p>
  
  <pre><code>        using (var package = new ExcelPackage(existingFile))
          {
              ExcelWorkbook workBook = package.Workbook;
              var currentWorksheet = workBook.Worksheets.First();
              currentWorksheet.Workbook.CalcMode = ExcelCalcMode.Automatic;
              currentWorksheet.Cells["C4"].Formula = "=SUM(C2:C3)";
              currentWorksheet.Cells["C2"].Value = 10;
              currentWorksheet.Cells["C3"].Value = 30;
              package.Save();
  
  
          }
  
          using (var package = new ExcelPackage(existingFile))
          {
              ExcelWorkbook workBook = package.Workbook;
              var currentWorksheet = workBook.Worksheets.First();
              d.Average = Convert.ToDouble(currentWorksheet.Cells["C4"].Value);
          }
  </code></pre>