denno Posted December 20, 2007 Posted December 20, 2007 I have a field named FullName from which I need to extract the last name into a separate field. I used the Calculatoin in the manual to do this when the field used the format of "FIrstName LastName" but we had to change the field to display "First Last, Title." Can anyone help with a Calc to do this? A comma always follows the last name. i.e., John Smith, MD --> Smith Thanks!
Lee Smith Posted December 20, 2007 Posted December 20, 2007 We just had this topic. See if this Link doesn't answer your questions. Be sure to follow any links, and download the example file(s) HTH Lee
denno Posted December 21, 2007 Author Posted December 21, 2007 Thanks-is there an easier way using Position and one of the Word functions?
Lee Smith Posted December 21, 2007 Posted December 21, 2007 (edited) It will break with just about any entry other than one word last names. RightWords (YourField; 1) Edited December 21, 2007 by Guest
comment Posted December 21, 2007 Posted December 21, 2007 Try: Let ( [ len = Length ( FullName ) ; end = Position ( FullName ; "," ; len ; - 1 ) ; start = Position ( FullName ; " " ; end ; - 1 ) + 1 ] ; Middle ( FullName ; start ; end - start ) )
denno Posted December 21, 2007 Author Posted December 21, 2007 thanks--stupid question, though...where does the Let function go in the Calc for the lastname field?
comment Posted December 21, 2007 Posted December 21, 2007 In the calculation formula box? Or perhaps I don't understand your question.
denno Posted December 21, 2007 Author Posted December 21, 2007 I haven't used the Let command before. Would I just enter what you posted into the Calc definition for the LastName field?
comment Posted December 21, 2007 Posted December 21, 2007 Yes. Let() is a function like any other function.
Lee Smith Posted December 21, 2007 Posted December 21, 2007 ...where does the Let function go in the Calc for the lastname field? Yes.
Recommended Posts
This topic is 6242 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now