You can determine if a cell is formatted as a percentage by testing the cell data format string as follows:
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { if (cell.getCellStyle().getDataFormatString().contains("%")) { // Detect Percent Values Double value = cell.getNumericCellValue() * 100; System.out.println("Percent value found = " + value.toString() +"%"); } else { Double value = cell.getNumericCellValue(); System.out.println("Non percent value found = " + value.toString()); } }
This should allow you to distinguish between percentage formatted values ββand regular numeric values.
source share