English

How To: Identify duplicate field values in ArcGIS 10.x

Summary

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.

Procedure

  1. Create a new field. Set the type as short or long integer and accept the other defaults.
    1. If editing, stop the current edit session.
    2. Open the feature class attribute table.
    3. Click the Table Options button.
    4. Select Add Field to open the Add Field dialog box.
    5. Name the field.
    6. Select Long Integer from the Type drop-down list.
    7. Accept the default values for all Field Properties.
    8. Click OK.
  2. Right-click the newly created field and select Field Calculator.
  3. Select the Python parser.
Field Calculator with Python parser button
  1. Ensure that the Show Codeblock option is checked.
  2. 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
  1. 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:
Pre-Logic Script Code box
  1. 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.

Related Information