:confused:HELLO PLS VBA CODE FOR THIS FILE EXAMPLE EXTRACT TRIPLES: 1,4,6 OR 2,9,48
AND I MUST 4-6DIGITCODE TO EXTRACT EXAMPLE 1,4,6,12 1,4,6,12,15 1,4,6,12,15,18 PLS
https://www.dropbox.com/s/0ksum9oewkxuw7o/200test.xlsx
THIS MACRO IS FOR TRIPLES
Sub blah()
Set d = CreateObject("Scripting.dictionary")
Set cll = Range("A1")
Dim X()
Do
xx = Split(Application.Trim(cll.Value))
Debug.Assert UBound(xx) = 5
If UBound(xx) = 5 Then
For I = 0 To 3
For j = I + 1 To 4
For k = j + 1 To 5
Smaller = Application.Min(xx(I), xx(j), xx(k))
Larger = Application.Max(xx(I), xx(j), xx(k))
Middle = Application.Median(xx(I), xx(j), xx(k))
thisTriplet = Format(Smaller, "00") & "," & Format(Middle, "00") & "," & Format(Larger, "00")
If d.Exists(thisTriplet) Then
d.Item(thisTriplet) = d.Item(thisTriplet) + 1
Else
d.Add thisTriplet, 1
End If
Next k
Next j
Next I
End If
Set cll = cll.Offset(1)
Loop Until IsEmpty(cll)
ReDim X(1 To d.Count, 1 To 2)
I = 0
For Each p In d.Keys
I = I + 1
X(I, 1) = p
X(I, 2) = d.Item(p)
Next p
Set rngResults = Range("C2").Resize(d.Count, 2)
rngResults.Value = X
With ActiveSheet.Sort
.SortFields.Clear
.SortFields.Add Key:=rngResults.Columns(2), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
.SortFields.Add Key:=rngResults.Columns(1), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange rngResults
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub