HOW TO

Use the Field Calculator to add a prefix and a space to a field

Last Published: April 25, 2020

Summary

A field value may be added that includes a prefix followed by a space. For example, a state prefix and a space can be added to a city field in the attribute table. The image below shows the City field being added with a prefix value of TX and a space.

Screenshot of a field with a prefix.

Procedure

With the Field Calculator, add a field with a user-defined prefix or use an existing field from the attribute table.

Adding a user-defined prefix
  1. In ArcMap, start an edit session. For more information on starting an edit session, refer to ArcGIS Help: Starting an edit session (Start Editing).
  2. Right-click the feature with the attribute table to be added with a prefix. Click Open Attribute Table.
  3. Right-click the field where the prefix is added. Click Field Calculator.  
  4. In the Field Calculator, enter the following expression in the text field at the bottom of the dialog window, depending on the parser language:
For VB Script:
"<The prefix>" + " "+ "<the field>"
Screenshot of the Field Calculator with an example expression in VBScript.

For Python:
"<The prefix>" + " "+ !<the field>!
Screenshot of the Field Calculator with an example expression in Python.
  1. Click OK. The prefix is added to the field as defined by the expression.
Using an existing field from the attribute table

If the attribute table has existing fields to be used as the prefix for another field, concatenate the prefix field and the field to be prefixed. For more information on how to concatenate fields, refer to How To: Use ArcMap to concatenate fields in a table.

Article ID: 000018036

Software:
  • ArcMap

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options