Counting characters
Try this UDF:
Public Function AlphaCount(rng As Range) As Integer
Dim sStr As String, i As Long, sStr1 As String
Dim sChar As String
AlphaCount = 0
sStr = rng.Value
For i = 1 To Len(sStr)
sChar = Mid(sStr, i, 1)
If sChar Like "[a-z]" Then
AlphaCount = AlphaCount + 1
End If
Next
End Function
--
Gary''s Student - gsnu200837
"LiAD" wrote:
Good morning,
I have a list of inputs which are mixed between text, spaces, numbers and
symbols and i would like a function to count the number of letters in a
string.
fred smith+346785 result required - 10
(counts from f to t)
jonathon tate 56789321 - 13
(j to e)
bill +21988762 - 4
What is the best function to use for this?
Thanks
LiAD
|