It is obviously missing check for named reference before cast in EDate.java.
Here is the stacktrace
Caused by: java.lang.ClassCastException: org.apache.poi.ss.formula.LazyRefEval cannot be cast to org.apache.poi.ss.formula.eval.NumberEval
at org.apache.poi.ss.formula.functions.EDate.evaluate(EDate.java:39)
at org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:64)
at org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:525)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:288)
at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:230)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:264)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCell(XSSFFormulaEvaluator.java:151)
at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateAllFormulaCells(HSSFFormulaEvaluator.java:324)
at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateAllFormulaCells(HSSFFormulaEvaluator.java:315)
at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateAll(XSSFFormulaEvaluator.java:252)
<< omitted >>
I believe that substituting
NumberEval offsetInYearsValue = (NumberEval) args[1];
with
if (args[1] instanceof RefEval) {
args[1] = ((RefEval) args[1]).getInnerValueEval();
}
NumberEval offsetInYearsValue = (NumberEval) args[1];
resolves the issue

I have fixed this as far as possible in r1612557, however the case with blank cells does not work in POI currently because of the way dates below "1" are handled.
Currently POI sees these dates as invalid and thus always returns -1.0 as value from DateUtil methods, so this is what the emtpy-case results in.
Changing this would have side-effects in other places, so I kept it this way for now.

This is ASF Bugzilla: the Apache Software Foundation bug system. In case
of problems with the functioning of ASF Bugzilla, please contact
bugzilla-admin@apache.org.
Please Note: this e-mail address is only for reporting problems
with ASF Bugzilla. Mail about any other subject will be silently
ignored.