I need to obtain the sum(B) if the column has empty values I want to reflect 0.
I am automating this process for multiple sheets using app-script and need to use QUERY.
Any suggestions?
Google Sheets – QUERY – SUM() based on empty column
google sheetsgoogle-apps-scriptgoogle-sheets-query
Related Topic
- Google-sheets – Google Sheets Query sum single column based on criteria
- Google-sheets – Sheets QUERY (Select, Where, Contains, Limit) that works, except when blank cell
- Google-sheets – Summing Columns Based off Different Criteria in a group by in a Query Function in Google Sheets
- Google-sheets – Google Sheets formula IF or SUM with conditional formatting
- Using Google sheets `QUERY` instead of `VLOOKUP` – function returning empty – why
- Sum two grouped columns in Google Sheets QUERY Language
Best Answer
Use
n()
to convert blanks to zeros, like this:=arrayformula( query( n(A2:B), "select sum(Col1), sum(Col2)", 0 ) )