function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AardvarkAardvark 

Last name,First Name Formula

Hi everyone-

I have a custom field that I want to display the Last Name, First Name of a given account. For example, If the account name is "John and Jane Smith Household", I need the formula to populate the L,F Name field to say "Smith, John and Jane". Does anyone know the formula to do this?
Best Answer chosen by Aardvark
AardvarkAardvark
Here is an attempt at what I thought would be in the right direction. 
RIGHT( Full_Name__c,FIND(" ", Full_Name__c ,+1))+ "," + " " + LEFT( Full_Name__c,(LEN( Full_Name__c) -FIND(" ", Full_Name__c)))

 

All Answers

Abdul KhatriAbdul Khatri
Well there is no Last Name and First Name field on the Account Out Of Box, so are you saying that you created custom fields for that and you need to populate them through the Account Name.

Another question is that how you extract the First and Last Name, out of the full string Account Name, Is there any discipline is defining the Account Name, I mean is "and" word will always be there and also what not to consider. For example in your above example why you didn not consider Household part of your Last Name, why?
AardvarkAardvark
Hey Abdul,

Thanks for the response.

So what I'm essentially trying to do (I think) is parse the name field on the account object to create a L,F Name custom object on account. There won't always be an "and" on every household because some of our accounts are single individual accounts. Household is always included in the account name, but I don't want it included in the L,Fname object. I hope this helps. Thanks!
Abdul KhatriAbdul Khatri
Can you provide me what are the standards you have in defining the Account Name like as you said Household is always included and what validations you have if someone defining the Account Name.

Also few examples will help?
AardvarkAardvark
Hey Abdul. So usually, the account name is either:
John Doe Household (If the individual is single) or John and Jane Doe Household (if they are married). Aside from that, there really aren't any other standards to account for.
AardvarkAardvark
Some examples to help us out:
  • NAME (Object on Account): John Appleseed Household
  • L,FName (Custom Object on Account): Appleseed, John
  • NAME: John and Jerry Appleseed Household
    • L,FName: Appleseed, John and Jerry
  • NAME: Maximus and Regina Jones Household
    • L,FName: Jones, Maximus and Regina
 
AardvarkAardvark
Here is an attempt at what I thought would be in the right direction. 
RIGHT( Full_Name__c,FIND(" ", Full_Name__c ,+1))+ "," + " " + LEFT( Full_Name__c,(LEN( Full_Name__c) -FIND(" ", Full_Name__c)))

 
This was selected as the best answer