View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default Help Needed to Search and Find Specific Data

Suggested is the following:-

Sub CountCombins()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range
Dim c As Range

Set ws1 = Worksheets("Results")
Set ws2 = Worksheets("Combinations")
With ws1
Set rng1 = Range(.Range("A1"), .Range("A1").End(xlDown))
End With

Set rng2 = ws2.Range("A1:P65000")

For Each c In rng1
c(1, 2) = Application.CountIf(rng2, c.Value)
Next

End Sub

Regards,
Greg


-----Original Message-----
Hi Everyone,

I have a Worksheet with Combinations in the Format :-

01-02-03-04-05-06
01-02-03-04-05-07
01-02-03-04-05-08
etc

The Combinations are on a Worksheet Named "Combinations"

and go from
A1:P65000 for example. Each Combination is in a SINGLE

CELL.

What I would like to be able to do is to COUNT how many

times the
following Combinations Appear in the Worksheet

Named "Combinations" :-

01-02-03
03-05-08
01-02-03-04
03-04-05-08
01-02-03-04-05
04-05-06-07-08
01-02-03-04-05-06
etc

There could be as many as 30 or so to Check, Ranging from

3 Numbers up
to 6 Numbers.
The Combinations to Check will be in a Range on a

Worksheet Named
"Results" in A1:A30 for example.
Is there a Formula I could use to achieve this or will it

need to be
done using VB?.

Thanks very much in Advance.
Paul
.