Numbers of repeats of a string
Dear Bernd,
Thank you very much for the code. It is working fine, but for some
situations the strings size is limiting its use since it takes several
minutes, and even hours to perform the calculation. Unfortunately 90%
of the cases I have strings bigger than 200 characters. :(
Thank you again,
Luciano
On 15 abr, 11:38, Bernd P wrote:
Hello Luciano,
That was left as homework exercise :-)
Here we a
Function ShowRepetitions(v As Variant) As Variant
Dim i As Long, j As Long
On Error Resume Next
Do While v(i, 2) 1
* * i = i + 1
Loop
If v(i, 2) = 1 Then i = i - 1
On Error GoTo 0
ReDim vR(1 To Application.Caller.Rows.Count, 1 To 2) As Variant
For j = 1 To Application.Caller.Rows.Count
* * If j i Then
* * * * vR(j, 1) = ""
* * * * vR(j, 2) = ""
* * Else
* * * * vR(j, 1) = v(j, 1)
* * * * vR(j, 2) = v(j, 2)
* * End If
Next j
ShowRepetitions = vR
End Function
Array-enter:
=showrepetitions(GSort(pfreq(TRANSPOSE(GenSubStrin gs
(A1))),"DA","NS","21"))
Regards,
Bernd
|