Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
150 views
in Technique[技术] by (71.8m points)

excel - Distinct value of a column and do a count on each distinct value

Hi I have a column like this. Column

I know how to count the number of distinct value of this column, but I also want to do a count on what is the number of different distinct value.Is there an easy way to do that?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Considering the following example:

enter image description here

To get the unique values, and the occurrences of each unique value, you can do the following: enter image description here

The image is tiny, so here is are the formulas to type-in and drag down:

FORMULAS

1. Type in the first cell of column B:

=IF(ISERROR(INDEX($A$2:$A$8,MATCH(0,INDEX(COUNTIF($B$1:B1,$A$2:$A$8),0,0),0))),"",INDEX($A$2:$A$8,MATCH(0,INDEX(COUNTIF($B$1:B1,$A$2:$A$8),0,0),0)))

Drag the formula down the column B. You will get a list of unique values.

2. Type in the first cell of column C:

=COUNTIF($A$2:$A$8,B2)

Drag the formula down the column C. You will get the number of occurrences of each unique value.

RESULT

This is what you will get:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...