I am trying to use this formula but it's not working. Do you hava an idea why?

QUERY(IMPORTRANGE("IMPORTEDDATASHEET";"06_20!M:AJ");"SELECT SUM(Col17) WHERE Col1 = 'Company Name' AND Col23 <> ' ' label SUM(Col17) ''")

I want to filter by a specific company name in Col1 and filter out all empty cells in Col23 and then sum up Col17.

I also tried IS NOT NULL and != ' ' instead of <> ' ', it didn't work either.

1 Answer 1


You have an aggregate — SUM(Col17) — which means you need to GROUP BY some column (e.g., add GROUP BY Col1 to the QUERY before LABEL). If you don't tell the QUERY how to organize (i.e., GROUP) the aggregate function, it will throw an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.