Bug 66651 - References to non existing named cells inside Formulas throws exception even with IF/ISERROR
Summary: References to non existing named cells inside Formulas throws exception even ...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 5.2.3-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-15 20:05 UTC by Arieh Kellermann
Modified: 2023-06-15 20:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arieh Kellermann 2023-06-15 20:05:42 UTC
If there is a reference to a non existent named cell in a formula the following exception is thrown:
"Specified named range 'NAMEVAR' does not exist in the current workbook."

This is also the case if the name is wrapped inside a "ISERROR" or "IFERROR".

There we would expect the same behavior as in Excel, also even if it is just inserted I'd expect a Name error in the Cell and not a runtime exception, essentially the same behavior that is present if a formula is set to divide by 0.

Also there if there is a reference to an non existing sheet or external workbook then one can use:
>FormulaEvaluator#setIgnoreMissingWorkbooks()
to get Excels behavior, but named cells will still fail.

Code to reproduce:
>Workbook workbook = new XSSFWorkbook();
>Cell cell = workbook.createSheet().createRow(0).createCell(0);
>cell.setCellFormula("ISERROR(NAMEVAR)");