The HSSFCell
object has methods .setCellType
and .setCellFormula
which you need to call like this:
// "cell" object previously created or looked up
String strFormula= "SUM(A1:A10)";
cell.setCellType(HSSFCell.CELL_TYPE_FORMULA);
cell.setCellFormula(strFormula);