From: Dominik Stadler Date: Sun, 19 Mar 2017 20:29:55 +0000 (+0000) Subject: 60823: DGET function, correct behavior with multiple result entries but only one... X-Git-Tag: REL_3_16_FINAL~30 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2f2c9944102cfff9d7640e94f4a3e8dd482326ce;p=poi.git 60823: DGET function, correct behavior with multiple result entries but only one non-blank git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1787658 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/ss/formula/functions/DGet.java b/src/java/org/apache/poi/ss/formula/functions/DGet.java index 0bf9cc2623..5cdc29251d 100644 --- a/src/java/org/apache/poi/ss/formula/functions/DGet.java +++ b/src/java/org/apache/poi/ss/formula/functions/DGet.java @@ -36,10 +36,18 @@ public final class DGet implements IDStarAlgorithm { { result = eval; } - else // There was a previous match, since there is only exactly one allowed, bail out. + else // There was a previous match. Only one non-blank result is allowed. #NUM! on multiple values. { - result = ErrorEval.NUM_ERROR; - return false; + if(result instanceof BlankEval) { + result = eval; + } + else { + // We have a previous filled result. + if(!(eval instanceof BlankEval)) { + result = ErrorEval.NUM_ERROR; + return false; + } + } } return true; diff --git a/test-data/spreadsheet/DGet.xls b/test-data/spreadsheet/DGet.xls index 729e974e4d..49514d20f5 100644 Binary files a/test-data/spreadsheet/DGet.xls and b/test-data/spreadsheet/DGet.xls differ