title: Getting Cells with Formulas in Excel file
body: <p>I am trying to read formulas of cells currently I am reading all cells in sheet which takes too much time. How can I only select those cells which have formulas.</p>
  
  <p>Here is the code I am using</p>
  
  <pre><code>foreach (Excel.Worksheet workSht in xWorkBook.Worksheets)
  {
      for (int rCnt = 1; rCnt &lt;= workSht .Rows.Count; rCnt++)
      {
          for (int cCnt = 1; cCnt &lt;= workSht .Columns.Count; cCnt++)
          {
              string str = (string)(workSht.Cells[rCnt, cCnt] as Excel.Range).Formula;
              if (str.Contains("_R*"))
              {
                  if (File.Exists(excelFilePath))
                  {
                      File.Delete(excelFilePath);
                  }
                  CloseExcelObject(ref xWorkBook, ref xApp);
                  return "UnReviewedFile";
              }
          }
      }
  }
  </code></pre>