1

I have an 11 digit ID in one field I'll call "Current_ID". I would like to create a new field named "New_Field" and populate it with same value except I need to change the value of the 4th digit from a 5 to a 4.

Example: 
"Current_ID" = 1505000001
"New_Field" desired ID =  1504000001

Both field types are Double

400 records

How can this be done using Field Calc?

  • 2
    You really should be using a Long instead of a Double field for storing IDs... – nmpeterson Mar 23 '16 at 20:58
6

Use field calculator expression:

"Current_ID"-1000000
6

If you're always only changing the fourth digit to a 4 - In field calculator on the New_Field select Python parser, and input the following:

int('{}4{}'.format(str( !Current_ID! )[:3], str( !Current_ID! )[4:]))

This will replace the fourth digit with a 4 (whatever that fourth digit may be).

If it needs to be a number other than 4, change the number in {}4{}

enter image description here

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.