I'm trying to add a formula to my spreadsheet that contains a SUMIF that references a cell. Here's the code for the formula I'm trying to add:
addFormula("(100 * " + dRangeCell + " / 256) * (SUMIF(B" + (dip.start+1) + ":B" + (dip.end+1) + ",\"<\"&" + dbThresholdCell + ")) / " + profile.getImageWidth(),
dipAreaPercentageCol, row, sheet, highlightedFormat);
The important part is the condition in the SUMIF, where I'm trying to do a sum if the values are less than the value in another cell.
When the code runs I get this error:
Warning: Lexical error: (100 * D18 / 256) * (SUMIF(B1:B2,"<"&D21)) / 332 at char 36 when parsing formula (100 * D18 / 256) * (SUMIF(B1:B2,"<"&D21)) / 332 in cell Profile!N24
The character it's complaining about is the ampersand. However, when I paste that exact formula into the spreadsheet in Excel it works perfectly.
Does JExcel not know how to parse the ampersand properly? Is there a workaround for my situation?