本文介绍了在Excel中计数唯一值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的列表:
Location ID
______________
Boston 12
Boston 12
Boston 12
Boston 57
Boston 99
Chicago 12
Chicago 13
...
对于每个位置,我想计数唯一ID的数量。波士顿会有3,芝加哥会有2个例如。
For each Location I want to count up the number of unique IDs. Boston would have 3 and Chicago would have 2 for example.
我可以使用高级过滤器的唯一记录,但我想知道如何使用Excel公式。 / p>
I can use Advanced filter by unique records but I want to know how to do this using an Excel formula.
推荐答案
使用此数组公式:
=SUM(IF($A$2:$A$8=D2,1/COUNTIFS($B$2:$B$8,$B$2:$B$8,$A$2:$A$8,D2)))
作为数组公式,退出编辑时需要使用Ctrl-Shift-Enter而不是Enter进行确认模式。如果正确完成,Excel将围绕公式放置 {}
。
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. If done correctly then Excel will put {}
around the formula.
这篇关于在Excel中计数唯一值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!