Free Support Forum -

setR1C1Formula Problem


I’d like to set formula dynamically.

So, I tried to do like this.

Workbook workbook = new Workbook(“test.xlsx”);

Worksheet worksheet = workbook.getWorksheets().get(0);

Cells cells = worksheet.getCells();

Sring strFormula = “=”+“A9”+“B2” ;

cells.get(rowIdx, colIdx).setR1C1Formula(strFormula);

However, when I got the result in the Cell which has been applied formula,

I got ‘NAME?’ Could you tell me how to fix this problem?

Thank you.

Could you please share the test.xlsx file and a file as expected output. We will analyze it and provide our feedback accordingly.


The issue is due to fact that the formula you set is not in R1C1 format. You should use cell.setFormula(strFormula) instead.