https://bz.apache.org/bugzilla/show_bug.cgi?id=56822
Sebastiaan Blommers <blommer...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #2 from Sebastiaan Blommers <blommer...@gmail.com> --- This test fails formula produces 3 instead of 2 @Test public void test2() { HSSFWorkbook workbook = new HSSFWorkbook(); Sheet sheet = workbook.createSheet("test"); Row row3 = sheet.createRow(2); Row row4 = sheet.createRow(3); Row row5 = sheet.createRow(4); Row row6 = sheet.createRow(5); Row row7 = sheet.createRow(6); Row row8 = sheet.createRow(7); Cell cellA3 = row3.createCell(0, CellType.STRING); Cell cellA4 = row4.createCell(0, CellType.STRING); Cell cellA5 = row5.createCell(0, CellType.STRING); Cell cellA6 = row6.createCell(0, CellType.STRING); Cell cellA7 = row7.createCell(0, CellType.STRING); Cell cellA8 = row8.createCell(0, CellType.STRING); Cell cellB3 = row3.createCell(1, CellType.NUMERIC); Cell cellB4 = row4.createCell(1, CellType.NUMERIC); Cell cellB5 = row5.createCell(1, CellType.NUMERIC); Cell cellB6 = row6.createCell(1, CellType.NUMERIC); Cell cellB7 = row7.createCell(1, CellType.NUMERIC); Cell cellB8 = row8.createCell(1, CellType.NUMERIC); cellA3.setCellValue("a"); cellA4.setCellValue("a"); cellA5.setCellValue("a"); cellA6.setCellValue("b"); cellA7.setCellValue("b"); cellA8.setCellValue("b"); cellB3.setCellValue(1); cellB4.setCellValue(1); cellB5.setCellValue(2); cellB6.setCellValue(2); cellB7.setCellValue(1); cellB8.setCellValue(2); Cell cellD3 = row3.createCell(2, CellType.FORMULA); cellD3.setCellFormula("COUNTIFS(A3:A8,\"a\",B3:B8,1)"); FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); CellValue evaluate = evaluator.evaluate(cellD3); Assert.assertEquals(2.0d, evaluate.getNumberValue()); } Above code of countifs fixes at least this unit test -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org