Google sheets 带有group by和count的查询缺少零计数Google工作表

Google sheets 带有group by和count的查询缺少零计数Google工作表,google-sheets,google-sheets-formula,Google Sheets,Google Sheets Formula,我可以使用 但是如果我添加第二个where子句 =QUERY(Sheet1!D2:H,"select D, count(E) where F = 'person-person' and H = 'Acquaintence' group by D") 我缺少我需要的零计数 谢谢你在这方面的帮助 谷歌数据表 试试这个: =数组公式(查询({Sheet1!D2:D,N(Sheet1!F2:F&Sheet1!H2:H=“person personAcquaintence”)},“选

我可以使用

但是如果我添加第二个
where
子句

=QUERY(Sheet1!D2:H,"select D, count(E) where F = 'person-person' and H = 'Acquaintence' group by D")
我缺少我需要的零计数

谢谢你在这方面的帮助

谷歌数据表 试试这个:

=数组公式(查询({Sheet1!D2:D,N(Sheet1!F2:F&Sheet1!H2:H=“person personAcquaintence”)},“选择Col1,求和(Col2),其中Col1“”按Col1分组”))


查询中的SUM()可以让您以计数不需要的方式显示0。

共享一份包含所需结果示例的工作表副本(示例)“零计数”是什么意思?我添加了一个带有示例的Google工作表,很抱歉混淆谢谢Matt,这是基于您的方法
=ARRAYFORMULA(查询({连接!D2:D,N(connections!H2:H=“熟人”)、connections!F2:F},“选择Col1,SUM(Col2),其中Col1”和Col3=“person-person”按Col1分组”)
Matt您能解释这部分吗?
,N(connections!H2:H=“熟人”)
thanks@xyz333很高兴你在附近!连接!H2:H=“熟识”只生成一个真/假数组。N()将真/假值转换为1和0,因此对1和0求和就像计数一样。这是一个很好的trix,我会记住的!再次感谢
=QUERY(Sheet1!D2:H,"select D, count(E) where F = 'person-person' and H = 'Acquaintence' group by D")