diff options
-rw-r--r-- | poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java | 5 | ||||
-rw-r--r-- | poi/src/test/java/org/apache/poi/ss/formula/atp/TestXLookupFunction.java | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java index 43ad217a5b..04ec1004b3 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/LookupUtils.java @@ -760,7 +760,10 @@ public final class LookupUtils { break; } if (result.isTypeMismatch()) { - handleMidValueTypeMismatch(lookupComparer, vector, bsi, i, reverse); + int newIdx = handleMidValueTypeMismatch(lookupComparer, vector, bsi, i, reverse); + if (newIdx >= 0) { + return newIdx; + } } else if (reverse) { bsi.narrowSearch(i, result.isGreaterThan()); } else { 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 ab66de7c5e..0f03e35eef 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 @@ -127,8 +127,7 @@ public class TestXLookupFunction { HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); HSSFCell cell = wb.getSheetAt(0).getRow(1).createCell(6); assertDouble(fe, cell, "XLOOKUP(E2,C2:C7,B2:B7,0,1,-2)", 0.37); - //TODO next assertion is not working and needs investigation - //assertDouble(fe, cell, "XLOOKUP(9700,C2:C7,B2:B7,0,0,-2)", 0.1); + assertDouble(fe, cell, "XLOOKUP(9700,C2:C7,B2:B7,0,0,-2)", 0.1); assertDouble(fe, cell, "XLOOKUP(39474,C2:C7,B2:B7,0,0,-2)", 0); } } |