How To: Replace the text in multiple fields within an attribute table using the Field Calculator tool
An attribute table is a database that contains non-spatial information about a set of geographic features in a geographic information system (GIS). The information is arranged so that each row represents a feature and each column represents one feature attribute. In ArcGIS, rows are known as records and columns are fields. Each field stores a specific type of data, such as a number, date, or piece of text.
The instructions provided describe how to use the Replace function in the Field Calculator tool to replace the text in multiple fields within an attribute table without having to edit every record individually.
To replace values in an attribute table:
- In ArcMap, open the feature class or the shapefile.
- Open the attribute table of the layer.
- Click the Editor menu on the Editor toolbar and select Start Editing.
- Right-click the desired field heading on the Attribute Table. This is to ensure only the selected field is amended.
- Select Field Calculator.
- In the Field Calculator dialog box, type the following in the expression box:
- Double-click the field name from the Fields list to enter the name into the expression box.
- Type the value to be replaced and the replacement value; enclose each value in quotation marks and separate with a comma.
- Click OK. Notice the changes made onto the selected field.
Replacing a string of text (such as 'Crabapple' with 'Honeylocust') replaces all instances of the string of text with 'Honeylocust'. For example:
• Crabapple > Honeylocust
• Crabapple, Beverly > Honeylocust, Beverly
• Robinson Crabapple > Robinson Honeylocust
To change only 'Crabapple' fields, use the 'Find and Replace' tool and select Whole Field from the Text Match drop-down menu. Use Knowledge Base article 42497 for more information.
- Go to the Editor menu and select Save Edits.
- Click the Editor menu again and select Stop Editing.
- HowTo: Replace one value for another within a field
- ArcGIS Help - Changing the case of text field values
- ArcGIS Help - Making simple field calculations
- ArcGIS Help - Calculate Field examples
- HowTo: Replace the text in multiple fields within an attribute table using the Find and Replace tool