diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-12-06 20:15:15 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-12-06 20:15:15 +0000 |
commit | cbea2321f0a196a7466342e1291378683d9ff6fd (patch) | |
tree | 81e7c9a207644420057f5c59db06d68df6b5a532 /poi | |
parent | 21039bd2b1064db9469d6cfec83308c3418a0139 (diff) | |
download | poi-cbea2321f0a196a7466342e1291378683d9ff6fd.tar.gz poi-cbea2321f0a196a7466342e1291378683d9ff6fd.zip |
try to get xlookup example 6 to work
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895634 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r-- | poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java | 4 | ||||
-rw-r--r-- | poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java index 31649a5d85..47a4b33404 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/FormulaParser.java @@ -413,7 +413,9 @@ public final class FormulaParser { if (tkn instanceof AbstractFunctionPtg) { AbstractFunctionPtg afp = (AbstractFunctionPtg) tkn; byte returnClass = afp.getDefaultOperandClass(); - return Ptg.CLASS_REF == returnClass; + //CLASS_VALUE was added as valid to support example 6 in + //https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929 + return Ptg.CLASS_REF == returnClass || Ptg.CLASS_VALUE == returnClass; } if (tkn instanceof ValueOperatorPtg) { return false; diff --git a/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java b/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java index ced480a227..1e32802bc9 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java @@ -149,8 +149,7 @@ public class TestXLookupFunction { HSSFCell cell = wb.getSheetAt(0).getRow(2).createCell(3); assertDouble(fe, cell, "XLOOKUP(B3,B6:B10,E6:E10)", 75.28); assertDouble(fe, cell, "XLOOKUP(C3,B6:B10,E6:E10)", 17.25); - //TODO next to fix FormulaParser to get this to work - //assertDouble(fe, cell, "SUM(XLOOKUP(B3,B6:B10,E6:E10):XLOOKUP(C3,B6:B10,E6:E10))", 110.70); + assertDouble(fe, cell, "SUM(XLOOKUP(B3,B6:B10,E6:E10):XLOOKUP(C3,B6:B10,E6:E10))", 110.69); } } |