How To Select Even or Odd (ArcGIS Calc)
How To Select Even or Odd (ArcGIS Calc)
Procedure
1. In ArcGIS Pro, click the Analysis tab on the top ribbon. Click the drop-down menu next
to Python, and click Python window.
2. In the Python window, insert the following command to select records with EVEN
values in a numeric field:
[SAMPLE: I select even values in an ODD_No field, to make them even later --
arcpy.management.SelectLayerByAttribute('House_Number', 'SUBSET_SELECTION', 'MOD ("ODD_HN",
2) = 0')]
3. Press Enter.
4. In the attribute field, click the Switch Selection option to select records with ODD
values in the numeric field.
Alternatively, in the Python window, insert the following command to select records with odd
values in the numeric field:
[SAMPLE: I select odd values in an EVEN_No field, to make them odd later --
arcpy.management.SelectLayerByAttribute('House_Number', 'SUBSET_SELECTION', 'MOD ("EVEN_HNo",
2) = 1')]
To use both Python commands consecutively, insert the following command to remove the
previous selection before selecting new records or click the Clear option in the Selection
group:
Additions: to change odd/even field values to even/odd, use field calc on the right field and enter <field
Name> + 1. This applies to both sides following the selection using the above python script!