VBA Solution To Extract Initials From A text String Name

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,616
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a text string (an individual's name ... surname, given) in B16 eg. "Martin, Allan"
I am looking for a VBA solution to extract the individual's initials to be put in cell C16.

In this example ... C16 = "AM"

I know how to get the "M", but I am not sure how to isolate the first letter after the space.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Not sure how to do this with VBA, but this regular formula will work for you, provided here are just 2 names...
[Table="width:, class:grid"][tr][td] [/td][td]
A​
[/td][td]
B​
[/td][/tr]
[tr][td]
1​
[/td][td]Martin, Allan[/td][td]AM[/td][/tr]
[/table]

B1=MID(A1,FIND(" ",A1)+1,1)&LEFT(A1,1)
perhaps you can adapt that to your code, although a regular formula will do just as well.
 
Upvote 0
Hello Ford, thank you. That was much simpler than I had anticipated. Thank you!
 
Upvote 0
Code:
Dim d() As String
r = "Martin, Allan"
d() = Split(r, ", ")
i = Left(d(1), 1) & Left(d(0), 1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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