counting entries within a cell's formula
I don't know if my previous reply got posted.
It is easy to use this function.
1) go to the tab on the bottom of the worksheet (normally sheet1) and right
click. Select view code
2) Go to VBA Menu and select insert Module. a new module 1 will be shown.
3) Paste code from Function to End Function.
4) Remove the that this website inserts.
5) You are done.
Use this function like any other function
=CountPlus(A3)
A3 will have a formula like =A1+A2
"Mark" wrote:
I've done my share of heavy Excel programming, but am a bit lost as to how
you would write this into a functional formula. Can you please elaborate on
how to create this custom function? Thanks
"Joel" wrote:
thsi custom function will count plus signs. The number of words is one more
than the plus signs
Function CountPlus(Mycell As Range)
MyString = Mycell.Formula
CountPlus = 0
For i = 1 To Len(MyString)
If StrComp("+", Mid(MyString, i, 1)) = 0 Then
CountPlus = CountPlus + 1
End If
Next i
End Function
"Mark" wrote:
I am interested in doing a count of entries within a cell. It would be
similar to a word count, but instead of counting words, I need to count the
plus signs (+) or something like that. I have a simple formula in the cell
like:
=100+1235+3456+0987+etc
and am only interested in determining how many entries are in there since
each number entry represents a program and I would like to know how many
programs are accounted for.
I've tried this variation on the word wount, but no success:
=IF(LEN(TRIM(B4))=0,0,LEN(TRIM(B4))-LEN(SUBSTITUTE(B4,CHAR(43)," "))+1)
|