How to get Initials

2 views
Skip to first unread message

Ashu K

unread,
Aug 21, 2015, 10:24:04 AM8/21/15
to Excel VBA Lab
Dear Seniors,

I have name in Cell and i want to get Initials of the Name.


For Example :

Data : Vipin Kumar Singh

Output : VKS


Kindly help.



Thanks & Regards
Ashu Kenith

Ashish Bhalara

unread,
Aug 21, 2015, 11:13:45 PM8/21/15
to Excel VBA Lab
Hi Ashu K,

Try below UDF.

Function Initial(Str As String) As String
Dim i As Integer
Initial = Left(Str, 1)
For i = 1 To Len(Str)
    If Mid(Str, i, 1) = " " Then
        Initial = Initial + Mid(Str, i + 1, 1)
    End If
Next i
Initial = StrConv(Initial, vbUpperCase)
End Function

--
www.ExcelVbaLab.com
---
You received this message because you are subscribed to the Google Groups "Excel VBA Lab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ExcelVbaLab...@googlegroups.com.
To post to this group, send email to Excel...@googlegroups.com.
Visit this group at http://groups.google.com/group/ExcelVbaLab.
To view this discussion on the web visit https://groups.google.com/d/msgid/ExcelVbaLab/fdc2f72d-2495-4f64-a6d5-038b7c888b34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ashish Kumar

unread,
Aug 21, 2015, 11:29:24 PM8/21/15
to Excel VBA Lab, excel...@googlegroups.com
Hi Ashish Bhalara,


Perfect Solution..!



Regards
Ashish Kumar

Ashu K

unread,
Aug 22, 2015, 9:13:13 AM8/22/15
to Excel VBA Lab, excel...@googlegroups.com
Dear Ashish Bhalara Sir,

Thanks you so much.
Reply all
Reply to author
Forward
0 new messages