A counting function

B

Bobby

Hi! Is there in EXCEL(VBA) a builtin function that count the occurences
in a string. I.E.:
var1 = "Monday Tuesday Wednesday"
Tthe builtin would return the number 3(for 3 words in the string).
Thank's ahead
 
B

Bob Phillips

One way

var1 = "Monday Tuesday Wednesday"
ary = Split(var1, " ")
MsgBox UBound(ary) - LBound(ary) + 1

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
B

Bobby

Thank's Bob! I would love to "remove nothere from email address if
mailing direct" but where do I go for that change?( I did look in my
profile and cannot fing it there)
 
B

Bob Phillips

Sorry, are you asking what to do with that code?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
B

Bobby

No no Bob! I know and understand your code it's great! I think I miss
interpreted the inscription under your answer(the written comment in
parenthesis) Sorry for the confusion I created.
 
N

Norman Jones

Hi Bob,

I suspect that Bobby has interpreted your:
(remove nothere from email address if mailing direct)

as an instruction to amend *his* details: he did not appreciate that it
represents a means of deciphering your email address.
 
B

Bob Phillips

No problems mate, I just didn't want to leave you stranded if there was more
help required.

Regards

Bob
 
Top