Pl see the file.
Try this code also for speed test.
Function NthMatch1(ByVal Lvalue As Variant, Lrange As Variant, Mnum As Variant)
Mstr = "|" & Join(Application.Transpose(Lrange), "|") & "|"
Start = 1
For c = 1 To Mnum
Found1 = InStr(Start, Mstr, "|" & Left(Lvalue, 1))
If Found1 > 0 Then
Start = Found1 + 1
If Mid(Mstr, Start, Len(Lvalue) + 1) = Lvalue & "|" Then
Start = Found1 + Len(Lvalue)
Else
c = c - 1
End If
End If
Next
Temp = Left(Mstr, Found1)
NthMatch1 = Len(Temp) - Len(Replace(Temp, "|", ""))
End Function
Bookmarks