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
This commit is contained in:
PJ Fanning 2021-12-06 20:15:15 +00:00
parent 21039bd2b1
commit cbea2321f0
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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);
}
}