Column A contains names like
Rahul Kumar Mishra
Rahul Kumar Vishwakarma
Sushil Kant Sharma
Ram Mohan Roy
Mohandas Karmachand Gandhi
Jawahar Lal Nehru
Want to know a formula in Column B to make them appear in abbreviated form like
RKM
RKV
SKS
RMR
MKG
JLN
Thanks
Hello,
this works for cells with up to three names (two spaces)
cheers,=LEFT(A1,1)&IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))>0,MID(A1,FIND(" ",A1)+1,1),"")&IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))>1,MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,1),"")
Teylyn - just for my learning (i am still a noob at formulae)
Why do you use a ">1" in the 2nd if function in the above formula?
What if there were four names, would we have to put an additional if loop to track that?
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Hi
this function will work for any number of names - it takes the first letter from each word
Select alt+F11 and copy it to your VBA area
in the worksheet, type =Acronym_maker(A1) to return the first letters of the text in cell A1
Function Acronym_maker(rng As Range) Dim arrNos As Variant Dim n As Long txt = "" arrNos = Split(rng, " ") For n = 0 To UBound(arrNos) txt = txt & Left(arrNos(n), 1) Next Acronym_maker = txt End Function
Why? It's not required to produce the result. Right() returns the rightmost character(s) of a string. If you want to pull initials from a name, Right() is not the right (!) function.But I want to use Right( function as well.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks