Public Function GroupFind(iString As String, GrpNum As Long, Optional delim As Variant)
Dim i As Long
Dim tempstring As String
If IsMissing(delim) Then delim = Chr(32)
If GrpNum = 1 Then
GroupFind = Left(iString, Application.Find(delim, iString) - 1)
Else
tempstring = iString
For i = 2 To GrpNum
tempstring = Right(tempstring, Len(tempstring) - Application.Find(delim, tempstring))
Next i
If IsError(Application.Find(delim, tempstring)) Then
GroupFind = Right(tempstring, Len(tempstring) - Len(delim) + 1)
Else
GroupFind = Left(Right(tempstring, Len(tempstring) - Len(delim) + 1), Application.Find(delim, tempstring) - Len(delim))
End If
End If
End Function