You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Hepzibah Rajulah <he...@googlemail.com> on 2007/07/05 15:25:56 UTC
If () --formula---help
Iam using POI 3.0
I want this formula to be set in the cell
IF(LEFT($B4,1)="Q",MAX($D$4:$G$16)+1,#NV)
I have done this like this
CellReference cellRefQG = *new* CellReference(4,4);
HSSFRow rowQG = dataSheet.getRow(cellRefQG.getRow());
HSSFCell cellQG = rowQG.getCell(cellRefQG.getCol());
String formQG =
"IF(LEFT($B"+(start+1)+",1)=\"Q\",MAX($D$4:$G$"+dataRows+")+10,#NV)";
cellQG.setCellFormula(formQG);
on doing so throws the error
Cannot Parse, sorry : Integer Expected @ 39 [Formula String was:
'IF(LEFT($B4,1)="Q",MAX($D$4:$G$16)+10,#NV);']
But the same formula works good in excel without problems.
Help would be highly appreciated
Re: If () --formula---help
Posted by Hepzibah Rajulah <he...@googlemail.com>.
With POI 2.5 the formulas were in the template and excel was automatically
recalculating the formulas . but now thought of
switching to POI 3.0 same does not happen hence wrote the following code
..but gives parse error ..
I want this formula to be set in the cell
>
> IF(LEFT($B4,1)="Q",MAX($D$4:$G$16)+1,#NV)
>
> I have done this like this
>
> CellReference cellRefQG = *new* CellReference(4,4);
>
> HSSFRow rowQG = dataSheet.getRow(cellRefQG.getRow());
>
> HSSFCell cellQG = rowQG.getCell(cellRefQG.getCol());
>
> String formQG =
> "IF(LEFT($B"+(start+1)+",1)=\"Q\",MAX($D$4:$G$"+dataRows+")+10,#NV)";
>
> cellQG.setCellFormula(formQG);
>
> on doing so throws the error
>
> Cannot Parse, sorry : Integer Expected @ 39 [Formula String was:
> 'IF(LEFT($B4,1)="Q",MAX($D$4:$G$16)+10,#NV);']
>
>
>
> But the same formula works good in excel without problems.
>
>
>
> Help would be highly appreciated
>
--
Hepzibah Rajulah