HOW TO

Select every nth record in a table or feature class

Last Published: April 25, 2020

Summary

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. 

Procedure

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
Therefore: 2n-x = 7, and
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

Article ID: 000016090

Software:
  • ArcMap

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options