How to ignore data previously counted by countif a

2019-08-02 18:26发布

I am attempting to exclude values my countif formula has already counted, and instead insert a value such as "Already counted".

I need to count how many times a specific item appears in a column, which I used the basic countif formula for: =COUNTIF(A:A,A2). It returned these results:

Name # of Name

Mike 2

Sally 2

John 3

Kim 2

Jose 2

Sally 2

John 3

Brenda 1

John 3

Jose 2

Kim 2

Mike 2

(Column A is the "Name", Column B is the formula column "# of Name".)

OK, great. The issue is when the second occurrence of "Sally" happens, it counts the word again. I would like to ignore it because it has already been counted, and instead insert another value, such as "Already Counted". Thank you for your help in advance.

标签: excel countif
2条回答
Evening l夕情丶
2楼-- · 2019-08-02 18:43

Use MATCH to test if first in the list:

=IF(MATCH(A2,A:A,0)=ROW(),COUNTIF(A:A,A2),"Already Counted")

enter image description here

查看更多
不美不萌又怎样
3楼-- · 2019-08-02 19:00

You can COUNTIF for the limited range ending with the current row, and, if more than 1, you know it was already counted

=IF(COUNTIF($A$2:A2,A2)=1,COUNTIF($A:$A,A2),"Already Counted")

enter image description here

EDIT: Having just seen it, I like Scott's solution also.

查看更多
登录 后发表回答