vba 计算列中有多少个值有重复

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15369425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 19:59:44  来源:igfitidea点击:

Count how many values have duplicates in a column

excelvba

提问by Parseltongue

I have values in a column like:

我在列中有值,例如:

08FHI800
08FHI800
08FHI800
07FJM933
07FJM933
89MNA900

I need a formula that tells me how many items in the column have corresponding duplicates. In this case, it would be 2.

我需要一个公式来告诉我列中有多少项具有相应的重复项。在这种情况下,它将是 2。

回答by barry houdini

Try this formula assuming data in A2:A100

假设 A2:A100 中的数据,试试这个公式

=SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100,A2:A100&"")-(COUNTIF(A2:A100,A2:A100&"")=1))

=SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100,A2:A100&"")-(COUNTIF(A2:A100,A2:A100&"")=1))

It will ignore blanks

它会忽略空白