2

I need help creating an if statement for moving data from one column to another if it is blank. Any suggestions? See screen shot for highlights noting the data that needs to be moved (po boxes).enter image description here

4

You can do this by using the Field Calculator in ArcMap. Look for examples here.

def calc(field_name_target,field_name_src):
  if field_name_target == "":
    return field_name_src
  else:
    return field_name_target

Expression:
calc(!field1!, !field2! )
  • 2
    Alex's answer is perfect. Though, I thought I should add, this can also be done by just selecting by attribute ([OWNER_ST_NAME] == "") and then calculating the selected records to equal the [OWNPOBOX] field. – GeoJohn Aug 21 '15 at 18:20
  • Great thank you. I did return an error when I used the example code you provided. "The above is a Python-specific error. The calculation is attempting to add or concatenate a string and a number. " Would that be because the fields are text and numerical? – Kristen Aug 21 '15 at 18:23
  • Thanks John! I thought you could do that too. That actually did the trick! so relieved. Love this site :) – Kristen Aug 21 '15 at 18:37

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.