计算 google 个工作表中多个工作表中某个单词的出现次数

Count number of occurrences of a word across multiple sheets in google sheets

有没有办法计算一个词在多个 sheet 中出现的次数?

例如我有以下数据

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

在 sheet 3 我希望它出现

ANIMALS     COUNT
cat         4
dog         3
mouse       1
elephant    1

它也应该是动态的,所以当我在 sheet 1 和 2 中添加一个条目时,它会出现在 sheet 3

我在 sheet 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'")

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