Created attachment 24270 [details] reproduction of the bug I have multiple workbooks and am referencing names from one workbook in a second workbook. When evaluating formulas containing one of these cross workbook name references using ForkedEvaluator I get the exception below. I have reproduced the problem in the attached example. Book1.xls and Book2.xls each have one sheet (Sheet1) with one cell (A1). Book1.xls has the name "MyCell" which references "Sheet1!A1". [Book1.xls]Sheet1!A1 contains the constant 100 and [Book2.xls]Sheet1!A1 contains the formula "=[Book1.xls]MyCell + 1" and thus should evaluate to 101 but instead yields an exception. Note that if I take out the "+1" in the formula I no longer get the exception but the result is a NameXEval object (not the expected NumberEval). Note also if I rewrite the formula as "[Book1.xls]Sheet1!A1 + 1" it works. But I would like to use the named references. Paul Exception in thread "main" java.lang.RuntimeException: Unexpected arg eval type (org.apache.poi.hssf.record.formula.eval.NameXEval) at org.apache.poi.hssf.record.formula.eval.OperandResolver.coerceValueToDouble(OperandResolver.java:221) at org.apache.poi.hssf.record.formula.eval.TwoOperandNumericOperation.singleOperandEvaluate(TwoOperandNumericOperation.java:27) at org.apache.poi.hssf.record.formula.eval.TwoOperandNumericOperation.evaluate(TwoOperandNumericOperation.java:33) at org.apache.poi.ss.formula.WorkbookEvaluator.invokeOperation(WorkbookEvaluator.java:398) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:333) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:216) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:180) at org.apache.poi.ss.formula.eval.forked.ForkedEvaluator.evaluate(ForkedEvaluator.java:109) at mypackage.poi.PoiBug.main(PoiBug.java:32)
I've discovered an issue (that appears to be similar to this issue) within an application that we have build (using POI 3.6). I can provide examples as needed, but is this specific issue slated for inclusion within POI 3.7? Thanks, Dave Sprague Director, Product Management Trintech
Does this problem still exist in POI 3.13? A lot of progress has been made with formula parsing and evaluation since POI 3.6.
No update in a long time and this may be fixed since a long time, setting this to resolved for now, please reopen if this is still a problem for you.