• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

UDF to concatenate first letter of each word in a cell

If you want to concatenate the first letter of each word in a cell .For example -


Input Output

Johnson & Johnson J & J

Procter & Gamble P & G

Boston Consulting Group B C G

Try this udf

[pre]
Code:
Function con_1stletter(str1 As String)

Dim arr1, i As Integer, str2 As String
arr1 = Split(str1, " ")
str2 = ""
For i = LBound(arr1) To UBound(arr1)
str2 = str2 & Left(arr1(i), 1) & " "
Next
con_1stletter = Application.WorksheetFunction.Trim(str2)

End Function
[/pre]
 
Back
Top