2017-06-24 98 views
0

我能夠回到使用下面的公式數據:谷歌電子表格查詢COUNT()

=ArrayFormula(Query(importRange("SPREADSHEET_KEY", "Sheet1!A1:z2500"), "Select Col8, COUNT(Col8), SUM(Col24)/COUNT(Col8) WHERE Col8 is not null GROUP BY Col8 order by SUM(Col24)/COUNT(Col8) desc)) 

這將返回所有可能行。我試圖做到的,是返回的數據只有COUNT(Col8) >= 5

我已經試過:

=ArrayFormula(Query(importRange("SPREADSHEET_KEY", "Sheet1!A1:z2500"), "Select Col8, COUNT(Col8), SUM(Col24)/COUNT(Col8) WHERE Col8 is not null and COUNT(Col8) >=5 GROUP BY Col8 order by SUM(Col24)/COUNT(Col8) desc)) 

以及

=ArrayFormula(Query(importRange("SPREADSHEET_KEY", "Sheet1!A1:z2500"), "Select Col8, COUNT(Col8), SUM(Col24)/COUNT(Col8) WHERE Col8 is not null GROUP BY Col8 order by SUM(Col24)/COUNT(Col8) desc"), "SELECT * WHERE Col2 >= 5") 

兩個返回的錯誤。

任何想法?

+0

返回哪些錯誤? –

+0

第1個返回COUNT在WHERE中是不允許的,而第2個返回ArrayFormula只需要1個參數但找到2 –

+0

在公式周圍放置一個FILTER(),按COUNT列過濾 – ttarchala

回答

0

您的語法在第二個公式中是錯誤的。用第二個查詢第一個查詢:

  =ArrayFormula(QUERY(Query(importRange("SPREADSHEET_KEY", "Sheet1!A1:z2500"), "Select Col8, COUNT(Col8), SUM(Col24)/COUNT(Col8) WHERE Col8 is not null GROUP BY Col8 order by SUM(Col24)/COUNT(Col8) desc"), "SELECT * WHERE Col2 >= 5"))