J.E. gave you a worksheet function--you'd use it in a cell.
Are you looking for a VBA suggestion?
dim myStr as string
mystr = worksheets("Sheet1").range("a1").value
msgbox len(mystr) - len(application.substitute(mystr,"+",""))
if you're using xl2k or higher, you could use:
msgbox len(mystr) - len(replace(mystr,"+",""))
DejaVu wrote:
Thanks for the help JE... but it didnt seem to work. It keeps telling
me -_Sub_or_Function_not_defined_-, then it highlites *Substitute*.
Maybe this will help. Here is my specific need.
I am getting a couple of strings from our AS/400 database. The strings
are numbers. For example, say I am getting the number of Apples, and
the number of Oranges.
_*Apples____Oranges*_
1___________4
5___________7
4___________1
4___________6
9___________5
I may get all the apples in one cell ... so I want cell A1 to look like
this when its done. =1+5+4+4+9
In a perfect world, I would want apples and oranges to be in the same
cell... like this: =(1+5+4+4+9)/(4+7+1+6+5)
The reason I need to know the number of plus signs, was for the first
part of this. I was averaging out the apples, so I needed to know how
many times apples showed up.
I hope this is a better explanation!!
Thanks JE,
DejaVu
--
DejaVu
------------------------------------------------------------------------
DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629
View this thread: http://www.excelforum.com/showthread...hreadid=466881
--
Dave Peterson