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
Anil YaduvanshiAnil Yaduvanshi 

How to take out First and last Name from a string?

I have a field web name on case object, which captures value like this Kumar, Anil @New Delhi, now I want to take out first and last name from this field. Eg: it should look like Anil Kumar. Can anyone suggest any formula or any other solution?
Best Answer chosen by Anil Yaduvanshi
YogeshMoreYogeshMore
Hi Anil,

Your problem has been solved. Past following code in your formula field.
LEFT (RIGHT(SuppliedName,(LEN(SuppliedName)- FIND(",", SuppliedName ))) , FIND ("@", RIGHT(SuppliedName,(LEN(SuppliedName)- FIND(",", SuppliedName ))) )-1)+' '+
LEFT (SuppliedName, FIND (",", SuppliedName)-1)
If your issue is solved then please mark this as a best answer.
 
Regards,
Yogesh
 

All Answers

YogeshMoreYogeshMore
Hi Anil,

Can you tell me the sample two three more string format with your expected output.
It helps me to solve your issue.


Regards,
Yogesh
Anil YaduvanshiAnil Yaduvanshi

Hi Yogesh,

Thank you for extending your hand for support. The sample strings can be as mentioned below

Prashar, Vaibhav @ New Delhi
Irvin, Nick @ New york
Kumar, Ramesh @ Kolkatta 

So, the pattern is Last Name, First Name @ City Name, and I want to get data from this fields as First Name Last Name.

Thanks in advance.

Regards,
Anil Kumar

Anil YaduvanshiAnil Yaduvanshi
I used this formula 

LEFT ( SuppliedName , FIND ("@", SuppliedName )-1)

and have got value as Kumar, Anil, however I need it as "Anil Kumar" without any comma.

I think we are very near to resolve it.
YogeshMoreYogeshMore
Hi Anil,

Your problem has been solved. Past following code in your formula field.
LEFT (RIGHT(SuppliedName,(LEN(SuppliedName)- FIND(",", SuppliedName ))) , FIND ("@", RIGHT(SuppliedName,(LEN(SuppliedName)- FIND(",", SuppliedName ))) )-1)+' '+
LEFT (SuppliedName, FIND (",", SuppliedName)-1)
If your issue is solved then please mark this as a best answer.
 
Regards,
Yogesh
 
This was selected as the best answer