View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Extract Middle Initial from Name

A slightly shorter formula to do the same thing...

=LEFT(A1,FIND(" ",A1))&IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))1,
MID(A1,FIND(" ",A1,FIND(" ",A1)+1)+1,255),"")


If A1 contains

John Smith

your formula returns "John ". Methinks it should return the last name too


Thanks for spotting that... I copied the wrong formula from my test sheet.
The correct one is..

=LEFT(A1,FIND(" ",A1))&IF(LEN(A1)-LEN(SUBSTITUTE(A1," ",""))1,MID(A1,FIND("
",A1,FIND(" ",A1)+1)+1,255),MID(A1,FIND(" ",A1)+1,255))

which, while still shorter than Mike's, it's not as dramatically shorter
than my mis-copying led me to believe it would be. I still think there is a
shorter formula available (just a feeling).

Rick