I struggle with Java including the HSSF routines provided by Scott Klements, and I wondered if someone might be able to help me with a formula problem.
I have an RPG program that creates a workbook with 2 sheets, the second sheet being blank - data will be manually pasted in by the user later - but I don't think that is the problem.
The program works, apart from a formula that I am trying to include in one of the columns, the formula referencing cells in the 2nd sheet via VLOOKUP.
When I try to run the program I get:
I know that the formula has been coded correctly (with all the concatenations) because if I output the value as text into the cell instead of as a formula, and then in the spreadsheet I prefix it with "=", it brings up the correct value. However, if I try to use this value to create a formula in the cell it blows up.
The formula value is:
Basically this takes the value in column A on the current row, looks up the value in column A in the 2nd sheet ('Last Month'), and returns the value in column G.
The RPG/Free code that generates this is:
cellid = 'A' + %char(rowCount+1);
sheetname = '''Last Month''';
celldata = 'IF(ISNA(VLOOKUP('+cellid+
','+sheetname+'!A:G,7,FALSE)=TRUE),"",VLOOKUP('+
cellid+','+sheetname+'!A:G,7,FALSE))';
hssf_formula(row: 19 : celldata: Numeric);
If I omit the single quote around the sheet name, the program works but the formula doesn't, by the way.
I have been tearing my hair out with this, any help would be much appreciated.
I have an RPG program that creates a workbook with 2 sheets, the second sheet being blank - data will be manually pasted in by the user later - but I don't think that is the problem.
The program works, apart from a formula that I am trying to include in one of the columns, the formula referencing cells in the 2nd sheet via VLOOKUP.
When I try to run the program I get:
The call to HSSF_FORMU ended in error
I know that the formula has been coded correctly (with all the concatenations) because if I output the value as text into the cell instead of as a formula, and then in the spreadsheet I prefix it with "=", it brings up the correct value. However, if I try to use this value to create a formula in the cell it blows up.
The formula value is:
IF(ISNA(VLOOKUP(A6,'Last Month'!A:G,7,FALSE)=TRUE),"",VLOOKUP(A6,'Last Month'!A:G,7,FALSE))
Basically this takes the value in column A on the current row, looks up the value in column A in the 2nd sheet ('Last Month'), and returns the value in column G.
The RPG/Free code that generates this is:
cellid = 'A' + %char(rowCount+1);
sheetname = '''Last Month''';
celldata = 'IF(ISNA(VLOOKUP('+cellid+
','+sheetname+'!A:G,7,FALSE)=TRUE),"",VLOOKUP('+
cellid+','+sheetname+'!A:G,7,FALSE))';
hssf_formula(row: 19 : celldata: Numeric);
If I omit the single quote around the sheet name, the program works but the formula doesn't, by the way.
I have been tearing my hair out with this, any help would be much appreciated.
Comment