[bug-49202] add PERCENTRANK function

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-08-07 14:27:41 +00:00
parent bb515fdc30
commit fc83c4929e
2 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,9 @@ public final class PercentRank implements Function {
try {
ValueEval ev = OperandResolver.getSingleValue(args[2], srcRowIndex, srcColumnIndex);
significance = OperandResolver.coerceValueToInt(ev);
if (significance < 1) {
return ErrorEval.NUM_ERROR;
}
} catch (EvaluationException e) {
return e.getErrorEval();
}

View File

@ -57,6 +57,7 @@ public class TestPercentRank {
confirmErrorResult(fe, cell, "PERCENTRANK(A2:A11,0)", FormulaError.NA);
confirmErrorResult(fe, cell, "PERCENTRANK(A2:A11,100)", FormulaError.NA);
confirmErrorResult(fe, cell, "PERCENTRANK(B2:B11,100)", FormulaError.NUM);
confirmErrorResult(fe, cell, "PERCENTRANK(A2:A11,8,0)", FormulaError.NUM);
}
}