Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Count unique entries

Status
Not open for further replies.

Brian555

Technical User
Apr 29, 2005
20
GB
PLEASE HELP with what seems to be a simple task but one that I cannot figure out.

I have a table in which one column lists UK cities e.g.
Manchester
London
Manchester
Leeds
Birmingham
Leeds
Leeds
Newcastle

My question is how can I count how many times each city appears in the column without using a great many COUNTIF formula's (the table is serveral hundred rows long and contains a large number of cities).

 
A pivot table will give you the information you seek.

[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
You can use this array formula:
=SUM(1/COUNTIF(A1:A25,A1:A25))

[attn]NOTE[/attn]: Enter by using [Ctrl]+[Shift]+{Enter]

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
John, Does that give how many times each city appears or does it count how many unique cities?



[Blue]Blue[/Blue] [Dragon]

If I wasn't Blue, I would just be a Dragon...
 
D'oh.

I suppose I should really start reading the posts before I answer. [blush]

I agree, a pivot table would be the easiest way. The only other thing that comes to mind would be to do an advanced filter, copy the visible cells and then paste them elsewhere on the sheet, and then doing your CountIfs.

Pivot table is much easier and faster.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
It counts Unique cities so if there are 4 unique cities this formula returns the value 4.
 
Just drag Cities into Row fields and then also drag it again from the list into the Data field ensuring it is set to Count and you have your counts.

Regards
Ken...............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Dear all

Many and sincere thanks to everyone who helped. The pivot table gave me the answer in five minutes.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top