View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shane Devenshire Shane Devenshire is offline
external usenet poster
 
Posts: 857
Default Counting characters

Hi,

And if your input looks like "Fred 123 Smith" or "Fred Smith 123 - John
Adams" or "1234 - Shane - 56789" or "Shane - 12134"? How do you want to
handle it. Or do you know this never happens.

For handling the last one above, that is a special charactor other than just
+ you can use this array formula

=MAX((CODE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)) 64)*ROW(INDIRECT("1:"&LEN(A1))))

This will not handle all other "special" characters, but will handle some.
If you know that the name always ends with a lowercase letter you can change
the 64 to 96 and handle a few other special characters. - To make it an array
press Shift+Ctrl+Enter to enter it.


--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"LiAD" wrote:

Good morning,

I have a list of inputs which are mixed between text, spaces, numbers and
symbols and i would like a function to count the number of letters in a
string.

fred smith+346785 result required - 10
(counts from f to t)
jonathon tate 56789321 - 13
(j to e)
bill +21988762 - 4

What is the best function to use for this?

Thanks
LiAD