Home > Net >  Google Sheets Nested Query with Aggregate Function
Google Sheets Nested Query with Aggregate Function

Time:02-11

I am trying to use the COUNT() function inside a nested query for Google Sheets. Here is the query I am using: =query('Salary Data'!B3:J35000, "SELECT '"&query('Salary Data'!B3:J35000, "SELECT COUNT(E) WHERE E >= 1000000")&"', COUNT(E) WHERE E >=900000 AND E < 1000000")

The query outputs 'count' for the result of the nested query instead of the count of salaries >= 1000000. How do I get the actual count from the subquery?

EDIT: It seems the subquery only returns the name of the aggregate function used, whether it is count, max, min, avg, etc.

CodePudding user response:

May be

={query('Salary Data'!B3:J35000, "SELECT COUNT(E) WHERE E > 90000 and E >= 1000000"),query('Salary Data'!B3:J35000, "SELECT COUNT(E) WHERE E >= 1000000")}

I really don't understand what you expect!

  • Related