YasserKhalil
Well-Known Member
Hello everyone
I need to count the numbers in a formula that looks like that
The numbers are separated by plus sign
I tried this UDF but it doesn't deal with formulas
I need to count the numbers in a formula that looks like that
Code:
=20+30+50
I tried this UDF but it doesn't deal with formulas
Code:
Function COUNTTEXT(ref_value As Range, ref_string As String) As Long
Dim I As Integer, Count As Integer
Count = 0
If Len(ref_string) <> 1 Then COUNTTEXT = CVErr(xlErrValue): Exit Function
For I = 1 To Len(ref_value.Value)
If Mid(ref_value, I, 1) = ref_string Then Count = Count + 1
Next
COUNTTEXT = Count
End Function