Reputation: 21795
I have in a cell:
=QUERY(A:B;"select A, sum(B) group by A")
Problem is that when there is a blank value in column B formula does not compute, how can I make that when a blank value is encountered in column B, it is taken as 0?
Previously I set those cells as 0, and it worked, but this time they are a lot of them.
Upvotes: 1
Views: 2710
Reputation: 16551
A bit strange, with a very simple example, it seems that everything works as expected:
Upvotes: 2
Reputation: 21795
First, Click Tools > Script Editor:
function zeroIfBlank() {
var range = SpreadsheetApp.getActiveSheet().getDataRange();
var numRows = range.getNumRows();
var numCols = range.getNumColumns();
for (var i = 1; i <= numRows; i++) {
for (var j = 1; j <= numCols; j++) {
var currentValue = range.getCell(i,j).getValue();
if(currentValue == '')
range.getCell(i,j).setValue(0);
}
}
}
Second, Tools > Script Manager > Run zeroIfBlank.
Upvotes: 1