Commit 53d363ba authored by GoshaZotov's avatar GoshaZotov

modify COUNTIF formula

parent 718e41f2
......@@ -5797,7 +5797,11 @@ function parseNum( str ) {
var res = false, rS;
if (cElementType.string === y.type) {
if ('<' === operator || '>' === operator || '<=' === operator || '>=' === operator) {
return _func[x.type][y.type](x, y, operator).toBool();
var _funcVal = _func[x.type][y.type](x, y, operator);
if(cElementType.error === _funcVal.type){
return false;
}
return _funcVal.toBool();
}
y = y.toString();
......@@ -5838,7 +5842,7 @@ function parseNum( str ) {
break;
case "=":
default:
res = (x.value == y.value);
res = (x.value === y.value);
break;
}
}
......
......@@ -2623,26 +2623,37 @@
arg1 = arg1.getElementRowCol(0, 0);
}
arg1 = arg1.tocString();
/*arg1 = arg1.tocString();
if (cElementType.string !== arg1.type) {
return this.value = new cError(cErrorType.wrong_value_type);
}
}*/
var compareValues = function(val, matchingInfo){
var res;
if(val.type === arg1.type && val.value === arg1.value){
return true;
}
res = matching(val, matchingInfo);
return res;
};
var val;
matchingInfo = AscCommonExcel.matchingValue(arg1.toString());
if (cElementType.cellsRange === arg0.type) {
arg0.foreach2(function (_val) {
_count += matching(_val, matchingInfo);
_count += compareValues(_val, matchingInfo);
})
} else if (cElementType.cellsRange3D === arg0.type) {
val = arg0.getValue();
for (var i = 0; i < val.length; i++) {
_count += matching(val[i], matchingInfo);
_count += compareValues(val[i], matchingInfo);
}
} else {
val = arg0.getValue();
_count += matching(val, matchingInfo);
_count += compareValues(val, matchingInfo);
}
return this.value = new cNumber(_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment