HOW TO
Instructions provided describe how to create sequential numbers in a field in ArcMap using Python in the Field Calculator.
Note: ArcMap is in Mature support and will be retired March 1, 2026. There are no plans for future releases of ArcMap, and it is recommended that you migrate to ArcGIS Pro. See Migrate from ArcMap to ArcGIS Pro for more information.
Note: The code in this article generates sequential numbers for unsorted data based on the OID or FID order. If the data is sorted on a field, the generated numbers are not sequential.
rec=0 def autoIncrement(): global rec pStart = 1 pInterval = 1 if (rec == 0): rec = pStart else: rec += pInterval return rec
autoIncrement()
Get help from ArcGIS experts
Download the Esri Support App