Excel allows quotes within string - but escapes it with a " before that. So, the formula - =RIGHT("test""ing", 3) is allowed in excel and returns the string "ing". Trying to do the same using HSSF gives an error. The call - cell.setCellFormula("RIGHT(\"test\"\"ing\", 3)"); The stacktrace - java.lang.RuntimeException: Cannot Parse, sorry : ) Expected Error: ) Expected at org.apache.poi.hssf.model.FormulaParser.Abort(FormulaParser.java:117) at org.apache.poi.hssf.model.FormulaParser.Expected (FormulaParser.java:124) at org.apache.poi.hssf.model.FormulaParser.Match(FormulaParser.java:184) at org.apache.poi.hssf.model.FormulaParser.function (FormulaParser.java:316) at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:265) at org.apache.poi.hssf.model.FormulaParser.Factor (FormulaParser.java:474) at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:548) at org.apache.poi.hssf.model.FormulaParser.Expression (FormulaParser.java:596) at org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:700) at org.apache.poi.hssf.usermodel.HSSFCell.setCellFormula (HSSFCell.java:678) at emr.test.Test.setSecondRow(Test.java:88) at emr.test.Test.main(Test.java:116) Exception in thread "main" cheers Conrad PS I'm using version 2.5 (the version combobox in poi bugzilla doesn't have that option!)
Mostly fixed in bug 44504. One extra bug was noticed - HSSFCell.getCellFormula() did not double up the double quotes present in string literals. Fix and junit added in svn r653608.