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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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