1

I'm currently trying to select multiple counts with different criteria. Unfortunately, I am getting a PARSE error when I try to combine them into the same query. They work fine individually, just not together. Anyone know how to fix this?

This works fine (separately)

Select count(Col2) where Col2 <= 180 

or 

Select count(Col2) where Col2 > 180

or

Select count(Col2)

This doesn't work (combined)

Select count(Col2) where Col2 <= 180, count(Col2) where Col2 > 180, count(Col2)

Error that I get when I try

Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered

1 Answer 1

0

you must use only one where

"select count(Col2) where Col2 <= 180 or Col2 > 180"

OR logic can be exchanged with AND logic if/when needed


try:

=INDEX(LET(a, A:B, {
 QUERY(a, "select count(Col2) where Col2 <= 180"), 
 QUERY(a, "select count(Col2) where Col2 > 180"), 
 QUERY(a, "select count(Col2)")}))
Sign up to request clarification or add additional context in comments.

3 Comments

Possible to have multiple WHERE clauses in the same statement? 🤔 I need separate counts for statistical analysis.
@AlanSTACK only once per statement. see: developers.google.com/chart/interactive/docs/…
Ah, I was trying to avoid multiple statements because of the aforementioned network calls. Looks like that isn't possible. Oh well.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.