I take it Len won't work when there are Characters in the cell.
In which case paste the following UDF (User Defined Function) into a VB Module and call it from Excel in the way of any normal function.
Function HowMany(Rng)
HowMany = 0
If IsNumeric(Rng) Then
HowMany = Len(Rng)
GoTo EndFunc
End If
For x = 1 To Len(Rng)
Ext = Mid$(Rng, x, 1)
If InStr(1, "0123456789", Ext, vbTextCompare) > 0 Then
HowMany = HowMany + 1
End If
Next
EndFunc:
End Function
I take it Len won't work when there are Characters in the cell.
In which case paste the following UDF (User Defined Function) into a VB Module and call it from Excel in the way of any normal function.
Function HowMany(Rng)
HowMany = 0
If IsNumeric(Rng) Then
HowMany = Len(Rng)
GoTo EndFunc
End If
For x = 1 To Len(Rng)
Ext = Mid$(Rng, x, 1)
If InStr(1, "0123456789", Ext, vbTextCompare) > 0 Then
HowMany = HowMany + 1
End If
Next
EndFunc:
End Function
Here is a simpler version of that function for you to use...Thank you so much s-o-s! Even after more than 10 years, your solution still works perfectly!
Function DigitCount(S As String) As Long
Dim X As Long
For X = 1 To Len(S)
If Mid(S, X, 1) Like "#" Then DigitCount = DigitCount + 1
Next
End Function