计算一个单词在Google表格中的多个表格中出现的次数

问题描述

有没有一种方法可以计算单词在多张纸上出现的次数

例如我有以下数据

Sheet1
ANIMALS
cat
cat
cat
dog
mouse
Sheet2
ANIMALS
cat
dog
dog
elephant

我希望在工作表3中出现

ANIMALS     COUNT
cat         4
dog         3
mouse       1
elephant    1

它也应该是动态的,因此当我在工作表1和2中添加条目时,它会出现在工作表3中

我在工作表3中使用以下公式,但它没有按我想象的那样工作

=ArrayFormula(QUERY({Sheet1!A2:A1000,Sheet2!A2:A1000},"select Col1,count(Col2) where Col1 != '' group by Col1 label Col1 'animals',count(Col2) 'Count'"))

有没有办法做到这一点?

解决方法

您需要将{Sheet1!A2:A1000,Sheet2!A2:A1000}替换为{Sheet1!A2:A1000;Sheet2!A2:A1000}

所以您的公式变为

=QUERY({Sheet1!A2:A1000;Sheet2!A2:A1000},"select Col1,count(Col1) where Col1 != '' group by Col1 label Col1 'animals',count(Col1) 'Count'")

使用;而不是,将一列堆叠在另一列之上。

enter image description here