1

My Problem

I have built a count query that returns the most common elements from column H in the final sheet:

 =QUERY(final!H2:H,"SELECT H, COUNT(H) GROUP BY H ORDER BY COUNT(H) DESC")

I would like to filter out elements that appear only once. In traditional SQL I would add:

 HAVING COUNT(H)>1

However, this fails with #VALUE! on Google Sheets.

My Question

How can I filter out query elements based on their count?

2

Based on this Google Forum answer, I've nested the query:

=QUERY(
      QUERY(
          final!H2:H,
          "SELECT H, COUNT(H) GROUP BY H ORDER BY COUNT(H) DESC"
      ), 
      "WHERE Col2 > 1")

Note that the column reference in the outer query is case sensitive, and must be exactly Col2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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