diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 5b4013b8aa..0dc1878a97 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -395,10 +395,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { if(cell.isPartOfArrayFormulaGroup()){ CellRangeAddress arrayRange = cell.getArrayFormulaRange(); - if (arrayRange.getNumberOfCells() > 1 && - // region.intersects(arrayRange) is more concise and probably correct. Is it equivalent? - ( arrayRange.isInRange(region.getFirstRow(), region.getFirstColumn()) || - arrayRange.isInRange(region.getFirstRow(), region.getFirstColumn())) ){ + if (arrayRange.getNumberOfCells() > 1 && region.intersects(arrayRange)) { String msg = "The range " + region.formatAsString() + " intersects with a multi-cell array formula. " + "You cannot merge cells of an array."; throw new IllegalStateException(msg);