Function Tally(sText As String, sFind As String) As Long
Dim lFind As Long Dim lLast As Long Do lFind = InStr(lLast + 1, sText, sFind) If lFind Then lLast = lFind Tally = Tally + 1 End If Loop Until lFind = 0 End Function A simple loop through your main string lets you count the occurrences of a specified character or string. This function is useful for determining if enough commas appearin your comma-delimited string: |