From 2f2c9944102cfff9d7640e94f4a3e8dd482326ce Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 19 Mar 2017 20:29:55 +0000 Subject: [PATCH] 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 --- .../apache/poi/ss/formula/functions/DGet.java | 14 +++++++++++--- test-data/spreadsheet/DGet.xls | Bin 53760 -> 54272 bytes 2 files changed, 11 insertions(+), 3 deletions(-) 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 729e974e4dfd4bf2e06b10c620cbb17b4b6bf719..49514d20f5651aba79c83feb6511d6128e24bf46 100644 GIT binary patch delta 1064 zcmZ`%T}u>U7(MUIe(O3*nJq2FEMx^~X;cV-X;c!mk|KSWR(?z>t@}BvS%DUL6_NTv zS3(5_QH&A;b(6K1-DwaMUUU&%)gP!Rr{|rWwup6>d3m05&U4K_*Pdt{V>e%3P zeZ(~Y;91)OGcBev7UHTLUE>V%yzD2g&K2gLC> zyvy%Y%XYP5YkoR>C2w>Gi6_gze!P?%BjLOEukVyw_zI1`s4?HU5ANAeeTF9BMZ4D1 zug0`Vlw2 zitl%Tg$F>VVfwp|y4i?%vX?h&A=HS)0Zf5U3L#D9|5&C3mMwwlC9s^pOm*%WW0pDl zXuvz3LI8(wgYaKerBH^$xLNFii2cJUPUk^AC1X%XCmzcJ`oOFRs#D03O&K=I=on2> zn?{g+&0pb_yl{3dZc5YFp@pAmUXvZ)Zfx0>DP|~;BEzDSRV-V< zRv~RRHnj;smfrSa3_-&%N_=o53NS>1IfGz=fcJMT9|(8Hj}aU_r%{Mx$men;Bb_kO(e= zv2W9&C}jw7!fPC;jgs4T{*;13K^wuHyNG7S?@WV1dIns3!>B-4 zk}s9$n=wUJy-QKY*#KJfuK}V40V9HkT>h)2|D$EJrtY zG<>*#DOM~afHdE}8;3*@HZn{)@v%xWOuG2&b+lm721cmgiywY~Ce$Ng9K;7-H#^Vq z)L#cpdeP{4H1Ihx1<8^?iieaG={-u@UW|&~rVnSvUaW=Hx4B1dpj0lG^#juFWv8;? nCjpHtJ3&o~JWCTj{m)l^8e0YWwenb8r{UG7p+0sYq8DHnAT*0P -- 2.39.5