Counting multiple occurences of names

Enduser

New Member
Joined
Mar 23, 2003
Messages
30
I need to count the number of times a name appears in a given cell, but only those that appear greater than 2 times. Additionally, I need to extract those names into a separate spreadsheet. The problem is, I don't yet know the names that will be entered. I know this is fairly easy with pivot tables, but I'm hoping to come up with a formula so that the names and numbers will update automatically anytime the name appears more than twice. Is this possible?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The counting of instances within a column can be handled easily with a formula, but the grouping of those > 2 to another sheet might require a VBA solution. As a starter, to count the instances of names in column A, rows 2 thru 200, in B2, dragged down to B200, enter --

=COUNTIF($A$2:$A2,$A2)

This formula will put a 1 in column B for a 1st instance, 2 for a 2nd, etc. You could then either sort the data on column B, and copy the chunk of >2 to the other sheet, or use a macro to extract those rows to the other sheet, keying on values in B > 2 only.
 
Upvote 0
Book1
ABCDEFG
119174Summary
2NameSortRankNameFreq
3jill83carol3
4jon114damon4
5damon42jill3
6damon  jon3
7jill    
8jon    
9jill    
10jon    
11carol11  
12piero    
13damon    
14damon    
15carol    
16lucas    
17thomas    
18thomas    
19carol    
Sheet1


A1:

=MATCH(REPT("z",255),A:A)

B1:

=A1-(CELL("Row",A3)-1)

B3, which is copied down...

=IF((COUNTIF($A$3:INDEX(A:A,$A$1),A3)>2)*ISNA(MATCH(A3,$A$2:A2,0)),SUMPRODUCT((A3>OFFSET($A$3,0,0,$B$1,1))+0)+1,"")

C1:

=COUNT($C$3:INDEX(C:C,A1))

C3, which is copied down...

=IF(B3<>"",RANK(B3,$B$3:INDEX(B:B,$A$1),1)+COUNTIF($B$3:B3,B3)-1,"")

E3, which is copied down...

=IF(ROW()-ROW($E$3)+1<=$C$1,INDEX($A$3:INDEX(A:A,$A$1),MATCH(ROW()-ROW($E$3)+1,$C$3:INDEX(C:C,$A$1),0)),"")

F3, which is copied down...

=IF(E3<>"",COUNTIF($A$3:INDEX(A:A,$A$1),E3),"")
 
Upvote 0
This works great, but I have one more question. is there a way to show only the top ten names with > 2 occurrences?
 
Upvote 0
I need the list to show only the top ten names (with the most occurrences) but none with less than 2. The difficulty is that I need it to happen automatically, without the user doing any sorting or filtering on their own. Also, I have no way to know how many names might be listed (that is why I needed to set it up so the names update automatically. Is it possible to do this with a custom filter?
 
Upvote 0
Enduser said:
I need the list to show only the top ten names (with the most occurrences) but none with less than 2...

Just extend what we already have...

The data is the same as in the earlier exhibit (last 5 rows are not shown here)...
aaExtract&CountDupsExt Enduser.xls
ABCDEFGH
119174Top3
2NameSortRankFreqRankIINameFreq
3jill8332damon4
4jon11433jill3
5damon4241jon3
6damon      
7jill      
8jon      
9jill      
10jon      
11carol1134  
12piero      
13damon      
14damon      
Sheet1


See next post for the formulas.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top