VBA/Formula - Get Initials from Full Name - Multiple names in cell

The Great SrH

Board Regular
Joined
Jan 16, 2015
Messages
179
Hi guys,

I can't find a code that will help me with this anywhere. I have a cell in Excel that may contain multiple names separated by a comma - I want to have these names converted to Initials but still separated by commas eg:

Cell A2 contains "John Smith, Betty White, Michael Jackson".

I want it to display "JS, BW, MJ" instead.

Happy for it to be VBA or a formula!

Thanks!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Heres a function:

Code:
Function INIT(rng As Range) As String

arr = Split(rng, ",")
For i = LBound(arr) To UBound(arr)
    arr(i) = Trim(arr(i))
    If InStr(arr(i), " ") > 0 Then
        INIT = INIT & Left(arr(i), 1) & Mid(arr(i), InStr(arr(i), " ") + 1, 1) & ","
    End If
Next
INIT = Left(INIT, Len(INIT) - 1)

End Function
 
Upvote 0
Try this:

Code:
Function GetCap(s As String) As String
  s = Replace(s, " ", "")
    For i = 1 To Len(s)
    If Mid(s, i, 1) Like "[!a-z]" Then GetCap = GetCap & Mid(s, i, 1)
    Next
  GetCap = Replace(GetCap, ",", ", ")
End Function
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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