Extracting Letters from Text

wbsman

New Member
Joined
Apr 27, 2018
Messages
6
Take three Words separated by spaces. I want the first letter after the space from each word and insert into a cell.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I'm sure there are better ways to do this, but try this:

Code:
=CONCATENATE(LEFT(A1,1),(MID(A1,FIND(" ",A1)+1,1)),MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,1))

That assumes your data starts in cell A1, update as needed.
 
Upvote 0
You are Brilliant, almost there. I want to take this string
(Dbl. Dutch Door 1) or any string and extract the letters after each space.

<tbody>
</tbody>
 
Upvote 0
OK, so I plugged that in to my test for my formula and I get DDD as a result, is that now what you want or what you are expecting?

If it isn't what you want, can you tell us what it should be then?
 
Upvote 0
Here's a UDF you can try. Not clear to me if you want the first letter of the first word or not. If you want it just add a space before the first word.
Excel Workbook
AB
1Dbl. Dutch Door 1DD1
2Aword Bword Cword DwordBCD
Sheet5

Code:
Function ExtractLettersAfterSpaces(S As String) As String
Dim V, i As Long
V = Split(S, " ")
For i = LBound(V) + 1 To UBound(V)
    ExtractLettersAfterSpaces = ExtractLettersAfterSpaces & Left(V(i), 1)
Next i
End Function
 
Upvote 0
=ExtractLettersAfterSpaces(A1) This is what i want, however it returns the value of (#Name?)
 
Upvote 0
OK, so I plugged that in to my test for my formula and I get DDD as a result, is that now what you want or what you are expecting?

If it isn't what you want, can you tell us what it should be then?

I'm wanting DDD1 from that to create item numbers.
 
Upvote 0
Did you copy and paste the vba code into your workbook? If not the function won't be know to excel.

And you never answered what you expected the output to be for your example.
 
Upvote 0
=ExtractLettersAfterSpaces(A1) This is what i want, however it returns the value of (#Name?)
That's because you didn't install the function correctly.

To install the UDF:
1. With your workbook active press Alt and F11 keys. This will open the VBE window.
2. In the project tree on the left of the VBE window, find your project and click on it.
3. On the VBE menu: Insert>Module
4. Copy the UDF from your browser window and paste it into the white space in the VBE window.
5. Close the VBE window and Save the workbook. If you are using Excel 2007 or a later version do a SaveAs and save it as a macro-enabled workbook (.xlsm file extension).
6. Use the UDF as you would any native Excel function.
7. Make sure you have enabled macros whenever you open the file or the code will not run.
 
Upvote 0

Forum statistics

Threads
1,216,555
Messages
6,131,372
Members
449,646
Latest member
dwalls

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