简体   繁体   中英

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 )?

Input: 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

Then use COUNTIF() formula to count an occurrence:

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

Put it into cell F2 then fill down.

1个

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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