title: How to read cell value from formula cell using apache poi
body: <p>I am trying to read  all the data from a excel file, which also have some formula cell,
  but i have no idea that which cell is formula cell. how can i read all the values from the cells irrespective of the type of the cell.</p>
  
  <p>My code looks like this</p>
  
  <pre><code>FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
  while (rows.hasNext()) {
       row = (HSSFRow) rows.next();
       Iterator cells = row.cellIterator();
       while (cells.hasNext()) {
               cell = (HSSFCell) cells.next();
               if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
                    ar.add(cell.getStringCellValue());
               } else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {
                   ar.add(cell.getNumericCellValue());
               }else if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
                   ar.add(evaluator.evaluateFormulaCell(cell));
               } else {
                   ar.add("");
               }
       }
  }
  </code></pre>
  
  <p>I am getting the formula cell value as 0</p>