Bug 64032

Summary: FormulaEvaluator executes IFERROR function bug
Product: POI Reporter: 蒋勇兵 <253684597>
Component: SS CommonAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 4.1.1-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description 蒋勇兵 2019-12-25 10:03:08 UTC
When I used the FormulaEvaluator to executes a formula,I found a bug.

The formula is 'IFERROR(VLOOKUP(C3,'2019.1'!$C$2:$AX$37,48,0),-0.001)','2019.1' in the formula is the name of the sheet I want to operate.

But when an error occurs('2019.1' doesnt exist),poi throw following exception information:

org.apache.poi.ss.formula.CollaboratingWorkbooksEnvironment$WorkbookNotFoundException: Could not resolve external workbook name '2019.1'. Workbook environment has not been set up.

Why not return -0.001 as defined in IFFERROR returned ?
Comment 1 Dominik Stadler 2020-12-30 22:07:14 UTC
There is a method for all formula-evaluators to ignore such missing workbooks, see BaseFormulaEvaluator#setIgnoreMissingWorkbooks().

Please try to use this method to configure how Apache POI behaves here. 

Please reopen tihs issue if this does not solve it in your case together with more information to reproduce it, i.e. ideally a self-contained piece of code which reproduces the situation that you encounter.