How To: Select every nth record in a table or feature class
To select every nth record in a table using Select by Attributes and, use the modulo function (MOD).
This avoids the use of Python scripting and can be input to the Feature Class to Feature Class tool. Extra modifications can be made to start at a particular record, as well.
Use the following formula:
MOD(OBJECTID+2n-x, n) = 0
- n is the every nth record
- x is the objectid to start from
A few examples:
For every fourth record, starting at OBJECTID = 1:
- n = 4
- x = 1
MOD(OBJECTID+7,4) = 0
Selects records 1, 5, 9, 13, and so forth.
For every third record, starting at OBJECTID = 2:
- n = 3
- x = 2
MOD(OBJECTID+4,3) = 0
Selects records 2, 5, 8, 11, and so forth.
Note that this formula fails for 2n < x