Saturday, 19 December 2020

How to Extract the first letter of Every word in a sentence in excel

 Use this code

------

Function ExtractFirstLetter(text) As String

mystring = Left(text, 1)

For i = 2 To Len(text) - 1

If Mid(text, i, 1) = " " Then

    mystring = mystring & Mid(text, i + 1, 1)

End If

Next i

ExtractFirstLetter = WorksheetFunction.Substitute(UCase(mystring), " ", "")

End Function

--------------

Use it like this:


-------------------

No comments:

Post a Comment