PICK UP FIRST CHARACTER OF WORD

G

Guest

In one column name of the companies are appearing but the lenght or number of
words in the name of company is unlimited. I would like to pick up first
character of each word (first character after the space). e.g. if number of
words in the name can consist of 25 words, in that case 25 first character
should be picked.

How to do that .... pl. help.
 
B

Bernard Liengme

Difficult to do with native functions.
Here is a User Defined Function that works.

Function acronym(mycell)
temp = Left(mycell, 1)
For j = 1 To Len(mycell)
If Mid(mycell, j, 1) = " " Then
mynext = Mid(mycell, j + 1, 1)
temp = temp & mynext
End If
Next j
acronym = UCase(temp)
End Function


Change last but one line to: acronym = temp if you do not want caps.
Unsure of how to use a User Defined Function? see
David McRitchie's site on "getting started" with VBA
http://www.mvps.org/dmcritchie/excel/getstarted.htm

best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top