You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Colene Merrilda <co...@googlemail.com> on 2010/06/10 10:32:24 UTC
parse error with if ()
Hello
Oam using POI 3.2-Final
1) Iam getting this error while writing the formula in the cell
.'IF(LEFT(B4,1)="Q",MAX($D$4:$G$78)+10,#N/A);
Cannot Parse, sorry : Integer Expected @ 38 [Formula String was:
'IF(LEFT(B4,1)="Q",MAX($D$4:$G$78)+10,#N/A);']
2) then iam writing a VLooKup() in a cell but the value is not shown..When i
go to the cell and press enter then the value is shown ..
*
int* namedCellIdxzwert = wb.getNameIndex("zielwert");
HSSFName namedCellzwert= wb.getNameAt(namedCellIdxzwert);
String referencezwert = namedCellzwert.getSheetName() + "!" + "$C$" +
dataRowBegin + ":" + "$K$" + dataRows;
namedCellzwert.setReference(referencezwert);
This is what i did String FormulaZWert = "VLOOKUP('Projekt Daten
'!$K$10;zielwert;4;FALSE)&"+"\" SNR\"";
HSSFRow rowDatawert = graph.getRow(4);
*if* (rowDatawert == *null*) {
graph.createRow(4);
}
HSSFCell cellZiel = rowDatawert.getCell((*short*) 2);
*if* (cellZiel == *null*) {
cellZiel= rowDatawert.createCell((*short*)2);
}
*if*(cellZiel != *null*){
cellZiel.setCellFormula(FormulaZWert);}
Where is the problem
Regards
Re: parse error with if ()
Posted by Josh Micich <jo...@gmail.com>.
Hepzibah is correct in suggesting the error is just with '#N/A',
however it seems this functionality was fixed here:
http://svn.apache.org/viewvc?view=revision&revision=693591
which was before the release of 3.2-FINAL (2008-10-19)
So I think there is a high chance that you are running a POI version
older than 3.2-FINAL
The suggested work around (i.e. to use NA() instead) should work fine,
but I'd be more worried about making sure you really are using POI
3.2.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: parse error with if ()
Posted by Hepzibah Rajulah <he...@googlemail.com>.
For IF() substituting ,#N/A with NA() will work :
IF(LEFT(B4,1)="Q",MAX($D$4:$G$78)+10,NA());
Regds
On Thu, Jun 10, 2010 at 10:32 AM, Colene Merrilda <
colene.merrilda@googlemail.com> wrote:
> Hello
>
> Oam using POI 3.2-Final
>
> 1) Iam getting this error while writing the formula in the cell
> .'IF(LEFT(B4,1)="Q",MAX($D$4:$G$78)+10,#N/A);
> Cannot Parse, sorry : Integer Expected @ 38 [Formula String was:
> 'IF(LEFT(B4,1)="Q",MAX($D$4:$G$78)+10,#N/A);']
>
>
> 2) then iam writing a VLooKup() in a cell but the value is not shown..When
> i
> go to the cell and press enter then the value is shown ..
>
> *
>
> int* namedCellIdxzwert = wb.getNameIndex("zielwert");
>
> HSSFName namedCellzwert= wb.getNameAt(namedCellIdxzwert);
>
> String referencezwert = namedCellzwert.getSheetName() + "!" + "$C$" +
> dataRowBegin + ":" + "$K$" + dataRows;
>
> namedCellzwert.setReference(referencezwert);
>
> This is what i did String FormulaZWert = "VLOOKUP('Projekt Daten
> '!$K$10;zielwert;4;FALSE)&"+"\" SNR\"";
>
> HSSFRow rowDatawert = graph.getRow(4);
>
> *if* (rowDatawert == *null*) {
>
> graph.createRow(4);
>
> }
>
> HSSFCell cellZiel = rowDatawert.getCell((*short*) 2);
>
> *if* (cellZiel == *null*) {
>
> cellZiel= rowDatawert.createCell((*short*)2);
>
> }
>
> *if*(cellZiel != *null*){
>
> cellZiel.setCellFormula(FormulaZWert);}
> Where is the problem
>
>
>
> Regards
>