title: How to get the formula cell value(data) using apache poi 3.1
body: <p>I am using Apache poi-3.1-FINAL-20080629 in my application. here, I have one problem using formula...</p>
  
  <p>My Cell has formula(sheet2!C10) and the data inside this cell is String type (e.g $3,456)...How to access that cell also want to display the formula.</p>
  
  <p>My code Looks like:</p>
  
  <pre><code>HSSFWorkbook wb = new HSSFWorkbook(file);
  HSSFSheet sheet = wb.getSheetAt(0);
  HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb);
  
  Iterator rows = sheet.rowIterator();
      while (rows.hasNext()) {
          HSSFRow row = (HSSFRow) rows.next();
          System.out.println("\n");
          Iterator cells = row.cellIterator();
          while (cells.hasNext()) {
  
              HSSFCell cell = (HSSFCell) cells.next();
  
              int cellType = cell.getCellType();
  
              if (HSSFCell.CELL_TYPE_NUMERIC == cellType)
                  System.out.print(cell.getNumericCellValue() + "     ");
              else if (HSSFCell.CELL_TYPE_STRING == cellType)
                  System.out.print(cell.getStringCellValue() + "     ");
              else if (HSSFCell.CELL_TYPE_BOOLEAN == cellType)
                  System.out.print(cell.getBooleanCellValue() + "     ");
              else if (HSSFCell.CELL_TYPE_BLANK == cellType)
                  System.out.print("BLANK     ");
              else if (HSSFCell.CELL_TYPE_FORMULA == cellType) {
                  System.out.print(evaluator.evaluateInCell(cell).toString()  );              }   else 
                  System.out.print("Unknown cell type " + cellType);
  
          }
  
      }
  </code></pre>
  
  <p>evaluator.evaluateInCell(cell).toString() is throwing null pointer exception. Please Help!!!</p>