Excel question

ckcollector

New Member
Joined
Sep 12, 2002
Messages
1
How can I make a list of objects that appear in a different list a specific number of times. I have a long list of names, and I would like a new list of names that appear in this list three or more times.

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Asala42

Well-known Member
Joined
Feb 26, 2002
Messages
2,318
How about a formula copied down the next column:

(Assuming your data is in Column A starting in A2)

=IF(COUNTIF($A$2:A2,A2)=3,A2,"")

HTH
 

Jay Petrulis

MrExcel MVP
Joined
Mar 17, 2002
Messages
2,040
Hi,

You can do this in Excel by using COUNTIF and some advanced filtering.

You can do this quite easily in VBA with something like the following routine.<pre>Sub test()
Dim cell As Range, Rng As Range, MyArr
Dim Counter As Long
Dim fn As WorksheetFunction

Set fn = Application.WorksheetFunction
Set Rng = ThisWorkbook.ActiveSheet.Range("A1:A26")

ReDim MyArr(1 To Rng.Cells.Count)

For Each cell In Rng
If fn.CountIf(Rng, cell) >= 3 Then
If IsError(Application.Match(cell, MyArr, 0)) Then
Counter = Counter + 1
MyArr(Counter) = cell
End If
End If
Next cell

If Counter Then
ThisWorkbook.ActiveSheet.Range("B1").Resize(Counter, 1) _
= fn.Transpose(MyArr)
End If

End Sub</pre>

Change the data range and the output ranges to match you data.

_________________
Bye,
Jay

EDIT: Added a bit or error handling at the end to run to completion even if no entries are listed 3 or more times.
This message was edited by Jay Petrulis on 2002-09-13 11:48
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,502
Messages
5,832,099
Members
430,111
Latest member
Francis Xavier

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
Top