get the first letter of each word in a string

LFKim2018

Active Member
Joined
Mar 24, 2018
Messages
267
say, I have a string: "The Greatest Show On Earth"
I just want to have the first letters of each word: "TGSOE"
pls help with the formula (not VBA) - maximum words per string = 5
many many thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I don't think you will do it with formula.....unless maybe the string is always going to be the same length.
Probably the best option would be a UDF, like this ffrom ExtendOffice

Code:
Function GFL(rng As Range) As String
    Dim arr
    Dim I As Long
    arr = VBA.Split(rng, " ")
    If IsArray(arr) Then
        For I = LBound(arr) To UBound(arr)
            GFL = GFL & Left(arr(I), 1)
        Next I
    Else
        GFL = Left(arr, 1)
    End If
End Function
 
Upvote 0
Try one of these, copied down.
B1 requires the CONCAT function which is only available in later versions of Excel and is an array formula so should be entered without the {} but confirmed with Ctrl+Shift+Enter, not just Enter. If confirmed correctly, Excel will insert the {}. The formula can then be copied down.
The C1 formula should work in all versions and does not require the Ctrl+Shift+Enter confirmation.

Excel Workbook
ABC
1The Greatest Show On EarthTGSOETGSOE
2
3Today is FridayTiFTiF
First letters
 
Upvote 0
Hi,

Here's a formula solution, a little lengthy thou:


Book1
AB
1The Greatest Show On EarthTGSOE
2Just Another SampleJAS
Sheet255
Cell Formulas
RangeFormula
B1=LEFT(A1,1)&LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),100,100)),1)&LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),200,100)),1)&LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),300,100)),1)&LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),400,100)),1)
 
Last edited:
Upvote 0
Here's a formula solution, a little lengthy thou:
jtakw's suggestion triggered another idea for the CONCAT function (in D1) that
- is shorter than my earlier CONCAT formula
- avoids the volatile INDIRECT function
- does not require the Ctrl+Shift+Enter confirmation

Excel Workbook
ABCD
1The Greatest Show On EarthTGSOETGSOETGSOE
2
3Today is FridayTiFTiFTiF
First letters
 
Upvote 0
Mr. Peter_SSs
thank you for your kind assistance.
the other formula - I don't have any problem.
with: (I prefer this one because of brevity)
=CONCAT(LEFT(TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),{0,1,2,3,4}*100+1,100)),1))

I am getting #NAME ?
what could be the problem?
many thanks
 
Last edited:
Upvote 0
Mr. jtakw
thank you for your assistance..

You're welcome.

Mr. Peter_SSs
I am getting #NAME ?
what could be the problem?

That would mean you Don't have the CONCAT function, it's only available with an Office 365 subscription.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,386
Members
448,891
Latest member
tpierce

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