如何按给定值对范围内的重复项数求和?

How to SUM the number of duplicates in a range by given value?

一个简单的例子如下:

Column A is the list containing all data
Column B is the list of all unique data in Column A without duplicates
Column C will be the number of duplicates for each item in Column B from Column A

如何为 C 列中的单元格编写一个简单的公式来对 A 列中 B 列中的每个项目求和?

我对 C1 使用了 =sum(lookup($a:$a=$B)),但收到:此函数的参数太少

一个简单的 countif() 就足够了,除非我误解了..

=COUNTIF($A:$A,B1)

如果 returns 计算第二个参数在第一个参数(范围)中出现的次数。

使用数据透视表可能更简单:

唯一列表是作为构建数据透视表的一部分创建的,并按字母顺序排序。出于控制目的,总数也可以是自动的。