enter image description here

I need to extract the acres from the legal description. I have tried "(!Legal!.split(" AC")[-1])" but it gave an error. I am using ArcGIS 10.2 using python in the field calculator. I realized why my scrip wouldn't work but can't quite figure it out. Any thoughts?

  • what about "(!Legal!.split(" ")[-2])"? – Barbarossa Aug 6 '15 at 15:50
  • That would work but Acres isn't always at the end of the field. – Jeff Timm Aug 6 '15 at 15:52

Try the following:

!Legal!.split(" AC")[0].split(" ")[-1]

The first split will separate the rest of the text from " AC" and the second will give you last text element separated by a space.

  • Some of the descriptions have more than one acreage listed, though, Regex would work well here, but damned if I can ever figure it out. – recurvata Aug 6 '15 at 16:08
  • I get an error "Whitespace is not allowed at this location". Also I would always need the last acre listed or total. – Jeff Timm Aug 6 '15 at 16:09
  • I tested this on text fields. Are you trying to calculate for a numeric field? – Barbarossa Aug 6 '15 at 16:10
  • No. On a text field. – Jeff Timm Aug 6 '15 at 16:11
  • @recurvata Is correct, there are multiple occurrences of AC in the text. Regex would be the way to go. – Barbarossa Aug 6 '15 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.