HI all ,
I have used a POI API and make excel sheet. I have calculated some value from cell with cell.setCellFormula("...") like calculating percentage , sum, etc.
Now if there is value like 0 in division formula then it will give me cell value like #DIV/0! . I want to replace that with n/a instead of #DIV/0!
Any suggestions how to achieve this?
After you’ve done the formula evaluation step, you’ll want to search for cells of type CELL_TYPE_ERROR or CELL_TYPE_FORMULA (with an error set). When you find one, you can call getErrorCellValue() to get the error type. If it’s one that you want to replace (eg FormulaError.DIV0) then simply call cell.setCellValue(“n/a”) to change it to a text cell with n/a in it.