extracting 1st letter of each word in a string

Here is a custom function:

Code:
Function Initials(Txt As String) As String
    Dim Arr As Variant
    Dim x As Integer
    Arr = Split(Txt, " ")
    For x = LBound(Arr) To UBound(Arr)
        Initials = Initials & Left(Arr(x), 1)
    Next x
End Function

Note that it requires Excel 2000 or later because it uses the Split function.

To use it, press Alt+F11 to access the VBE. Click your workbook in the Project window and choose Insert|Module. Paste the code into the window on the right, and pres Alt+F11 again to return to your workbook. You can use the function in a cell like this:

=Initials(A1)

If A1 contains "This is a sentence" the function returns "Tias".
 
Upvote 0
Hi,

Using ACONCAT that can be found searching this board:
Book1
ABCD
1YOUCAN'TDOBUSINESS,SITTINGONYOURASSYCDBSOYA
2
3
Sheet4



EDIT:

It would be easier to use Andrews UDF above if it works for you.
 
Upvote 0
Book1
ABCDEFGH
1ThisistheFirstSentenceTitFS
2ThisistheSecondSentenceTitSS
3Myfavoriteanimalisacat!Mfaiac
4Myreal.Excitingx-raycaneatlava!Mr.Excel
5
6
7
8
9
10
11
12
13
14
15
16
Sheet1


I put together a simple UDF that can acheive what you ask(at least I think it's what you're asking)
Code:
Function Initials(Target As String) As String
    Dim x As Integer
    
    Target = Application.WorksheetFunction.Trim(Target)
    If Mid(Target, 1, 1)<> " " Then Initials = Mid(Target, 1, 1)
    For x = 1 To Len(Target)
        If Mid(Target, x, 1) = " " Then Initials = Initials & Mid(Target, x + 1, 1)
    Next
    
End Function
 
Upvote 0
Hi all!

I hope someone can help me... I've been using the initials function as given by Andrew for quite some time now with no hassles at all. But when I sent it to someone else (with same version: Office XP) it doesn't want to work. It bombs out at the "Left" function. I then tried Jungheim's solution with the same result. This time only at the "mid" function.

Is there a setting somewhere in excel i'm missing???
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top