Question

I have a formula in excel sheet that has the following format

{=SUM(IF(C3:C65536=F11,B3:B65536))}

its a formula array. How do I implement this in Java using Apache POI API?

I did this in java

cell.setCellType(XSSFCell.CELL_TYPE_FORMULA);
cell.setCellFormula("SUM(IF(C3:C65536=F"+totalCtr+",B3:B65536))");

where totalCtr is an int variable that iterates from 0... n
and is part of "F" in the formula. So I can go from one cell to the next.

No correct solution

OTHER TIPS

The newer Version of POI supports array formulas

see https://poi.apache.org/spreadsheet/formula.html

 Array Formulas: via Sheet.setArrayFormula() and Sheet.removeArrayFormula()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top