简体   繁体   English

计算Excel中列的值

[英]Count values in a column in Excel

I have a city-name column and I want to count the number duplicates for each city. 我有一个城市名称列,我想计算每个城市重复的次数。 Is there a way I can generate the output without having to enter the labels in the output (like this one https://exceljet.net/formula/summary-count-with-countif )? 有没有一种方法可以生成输出而不必在输出中输入标签(例如https://exceljet.net/formula/summary-count-with-countif )?

Input: Thai Binh Dong Thap Ha Noi Ha Noi Daklak Ha Noi Hai Duong Thai Binh 输入: Thai Binh Dong Thap Ha Noi Ha Noi Daklak Ha Noi Hai Duong Thai Binh

Output 产量

Thai Binh----2 Dong Thap----1 Ha Noi-------3 Daklak-------1 Hai Duong----1

If your table is like this: 如果您的表是这样的:

 |   A     |
1|Thai Binh| 
2|Dong Thap|
3|Ha Noi   |
4|Ha Noi   |
5|Daklak   |
6|Ha Noi   |
7|Hai Duong| 
8|Thai Binh| 

Use this formula to extract unique values: 使用以下公式提取唯一值:

=IFERROR(INDEX($A$1:$A$8, MATCH(0,COUNTIF($E$1:E1, $A$1:$A$8), 0)),"")

Put it into cell E2 then press CTRL + SHIFT + ENTER 将其放入单元格E2然后按CTRL + SHIFT + ENTER

Then use COUNTIF() formula to count an occurrence: 然后,使用COUNTIF()公式对事件进行计数:

=COUNTIF($A$1:$A$8,E2)

Put it into cell F2 then fill down. 将其放入单元格F2然后填充。

1个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM