How To: Identify duplicate field values in ArcGIS 10.x
Note: The procedure below is for ArcGIS 10.0 or later versions. Python scripts are not a supported expression type in earlier versions.
Instructions provided demonstrate how to use the Field Calculator to identify duplicate field values. Single occurrences and the first occurrence of multiple values are flagged with 0. Duplicates are flagged with 1.
- Create a new field. Set the type as short or long integer and accept the other defaults.
- If editing, stop the current edit session.
- Open the feature class attribute table.
- Click the Table Options button.
- Select Add Field to open the Add Field dialog box.
- Name the field.
- Select Long Integer from the Type drop-down list.
- Accept the default values for all Field Properties.
- Click OK.
- Right-click the newly created field and select Field Calculator.
- Select the Python parser.
- Ensure that the Show Codeblock option is checked.
- Paste the following code into the Pre-Logic Script Code box:
uniqueList =  def isDuplicate(inValue): if inValue in uniqueList: return 1 else: uniqueList.append(inValue) return 0
- Type isDuplicate(!Field!) in the lower expression box and replace the word Field with the name of the field containing the duplicated values.
The results of steps 4 through 6 should resemble the following:
- Click OK. All duplicate records are designated with a value of 1 and non-duplicate records are designated with a value of 0 in the new field.
Last Published: 7/18/2019
Article ID: 000012758
Software: Legacy Products