-1

How can I do a where clause on an aggregated column? Or accomplish similar behavior in Google Sheets simply?

For example.. Where SUM(A) <> 0

CodeCamper
  • 6,609
  • 6
  • 44
  • 94

1 Answers1

0

Great question. One simple solution is to wrap the Query in another Query. But make sure you use Col1, Col2... format for at least the second Query. Take this as an example...

(filtering zeros of the aggregate sum)

=query(QUERY(Sheet1!A:B,"select A,sum(B) label sum(B) 'Sum'"),"select Col1,Col2 where Col2 <> 0")

Also I should note a warning, never use the where clause in the first Query unless you intend to filter out the individual transactions and not the sum.

CodeCamper
  • 6,609
  • 6
  • 44
  • 94