Select to view content in your preferred language

Removing text after comma

3879
4
Jump to solution
09-18-2018 01:27 PM
MelissaDrake
Occasional Contributor

I have a field contains owners name

Doe, John and Jane

I am trying to remove everything so just the last name shows
Doe

I have tried several codes but nothing is working so far. I have Desktop 10.4

Could anyone give me some help please?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

python parser in the field calculator, no need for a codeblock if it is a text field

!YourFieldName!.split(",")[0] 

View solution in original post

4 Replies
HåkonDreyer
Esri Contributor

Guessing you are using the field calculator, add a little Pre-Logic code:

def justname(txt):
   return txt[0: txt.find(',')]

Field calculator

MelissaDrake
Occasional Contributor

Thank you! It worked

0 Kudos
DanPatterson_Retired
MVP Emeritus

python parser in the field calculator, no need for a codeblock if it is a text field

!YourFieldName!.split(",")[0] 
MelissaDrake
Occasional Contributor

Thank you! I really appreciated the help.

0 Kudos