Taking First Letter from Each Word

  • I want get first letter from each word and whole text of last word from full name. For Examples;


    Full name is Sonali Lakshika Hasini Dikkubura. I want to take it as S.L.H. Dikkubura


    Another example is Sampath Kauminda Kaluarachchi. I want to take it as S.K. Kaluarachchi


    Like that I want to convert name. Please help me to do this one.


    Thank You!

  • You posted to a 5-year-old thread - I have split your post off to create your own thread.

    Ali :)


    Enthusiastic self-taught user of MS Excel who's always learning!
    If anyone has helped you towards solving a problem, then you can thank them by clicking on the like icon bottom right.

    :!:Forum Rules

  • Hello and Welcome to the Forum :smile:


    The easiest is to have your own function ... a UDF ...to be stored in a standard module


    You can test , with your Name in cell A2, in cell B2 =CleanName(A2)


    Code
    Public Function CleanName(sNames As String) As String
    Dim var As Variant
    Dim i As Integer
    var = Split(sNames, " ")
    For i = 0 To UBound(var) - 1
        CleanName = CleanName & Left(var(i), 1) & "."
    Next i
    CleanName = CleanName & var(UBound(var))
    End Function


    Hope this will help

  • Once you have tested the macro ... feel free to share your comments

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Would be great to get some kind of feedback ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!