计算Google表格每n行中一个单元格中出现的次数

问题描述 投票:1回答:1
=countif('Sheet2'!$K$6,$AD25)+countif('Sheet2'!$K$13,$AD25)+countif('Sheet2'!$K$20,$AD25)
  +countif('Sheet2'!$K$27,$AD25)+countif('Sheet2'!$K$34,$AD25)+countif('Sheet2'!$K$41,$AD25)
  +countif('Sheet2'!$K$48,$AD25)+countif('Sheet2'!$K$55,$AD25)

这是我到目前为止所拥有的,我想知道是否有一种更雄辩的方法来解决这个问题。

  1. 在Sheet2中,每7行从6开始(即6,13,20,27,34,41,...)在K列,有一个下拉列表,其中列出了项目列表,例如{苹果,橙色,香蕉}。
  2. $ AD25表示橙色。
  3. [在另一张表中,我使用上面的公式计算在下拉列表中选择“橙色”的次数。如果在$ K $ 6和$ K $ 34中选择了橙色,则公式将返回2。

[每周,我们一个一个地填写它,但是由于这是一个持续的过程,所以在完成第55行之后,我需要在公式中添加+countif('Sheet2'!$K$62,$AD25),这并不是很有效。

有更有效的方法吗?我想像的是

countif('Sheet2'!$K$mod(???, 7)=0,$AD25)

但无法真正弄清楚。

google-sheets filter google-sheets-formula counting google-sheets-query
1个回答
2
投票
像这样:

=QUERY(FILTER(A6:A, MOD(ROW(A6:A)-ROW(A6), 7)=0), "select Col1,count(Col1) where Col1 is not null group by Col1 label count(Col1)''", 0)

enter image description here
© www.soinside.com 2019 - 2024. All rights reserved.