xsanisty/calx.js

SUMIF is not working

AnthonyTerra opened this issue · 4 comments

I noticed SUMIF was always returning 0. It seems the Range is being set to an object and not to an array causing the length property to error with an undefined error.

SUMIF : function(range, criteria) {
var result = 0;
for (var i = 0; i < range.length; i++) {
result += (eval(range[i] + criteria)) ? range[i] : 0;
}
return result;
},

should be

SUMIF : function(rangeData, criteria) {
var result = 0;
var range = utility.objectToArray(rangeData);
for (var i = 0; i < range.length; i++) {
result += (eval(range[i] + criteria)) ? range[i] : 0;
}
return result;
},

Thanks for reporting,

currently sumif is already fixed, in progress fixing sumifs :)

Just push the fix for SUMIF and SUMIFS, please update to 2.2.6 and kindly test it :)

Awesome, I will test and let you know.

Sorry for the delay I was pulled off to another project. this issue is resolved