How to Select Every Nth Row in Excel (With Example)


You can use the following basic formula to select every nth row in Excel:

=OFFSET($A$1,(ROW()-1)*n,0)

This formula selects every nth row.

Simply change the value for n in the formula to select specific rows.

For example, you can use the following formula to select every 3rd row:

=OFFSET($A$1,(ROW()-1)*3,0)

The following examples show how to use this formula in practice.

Example: Select Every Nth Row in Excel

Suppose we have the following list of values in Excel:

We can use the following formula to select every third row from the list:

=OFFSET($A$1,(ROW()-1)*3,0)

We will type this formula into cell C1 and then copy and paste it to the remaining cells in column C:

select every nth row in Excel

Notice that every third row has been selected from the list of original values:

If we change the value of n in the formula, we can select a different nth value.

For example, we can use the following formula to select every fifth row from the list:

=OFFSET($A$1,(ROW()-1)*5,0)

We will type this formula into cell C1 and then copy and paste it to the remaining cells in column C:

Notice that every fifth row has been selected from the list of original values:

Additional Resources

The following tutorials explain how to perform other common operations in Excel:

How to Delete Filtered Rows in Excel
How to Count Filtered Rows in Excel
How to Sum Filtered Rows in Excel

5 Replies to “How to Select Every Nth Row in Excel (With Example)”

  1. We have to do this a lot. Students collect data at much higher than necessary rates and I need to cull it. necessary I find it a lot easier and intuitive to use a helper column and the INDIRECT function. Let us say I have my raw data in columns A and B, which are respectively time in milliseconds at intervals of 100 ms and the signal value in volts. I want 1 s averaged data every second. So first I run a 10 point moving average filter on column B and have the results in column C beginning in cell C1. of course the first meaningful data begins in Cell C10. so I first create a helper column in D, entering 10 in cell D1, 20 in cell D2 and then fill in the rest of the column by click and drag. In cell E1 I write
    =INDIRECT(“A”&(D1)), it writes what is in A10, when I fill and drag next cell down will be A20, A30 and so on, if at this point I want the data in seconds I could put a 0.001 multiplier before the INDIRECT statement. similarly every 10th point in the averaged signal column is extracted by the statement
    =INDIRECT(“C”&(D1))
    and click and drag down

    1. Hi Purnendu…Thank you for your post! Let us know if you any questions we can help with.

    1. Hi BevinB…If you want to **select every Nth row in Excel**, rather than just a single cell in the row, you can adjust the approach slightly. Here’s how to select the entire row instead of a single cell:

      —

      ### **Method 1: Using a Helper Column and Filter**
      1. **Create a Helper Column**:
      – Insert a new column next to your data (e.g., column `A` if your data starts in column `B`).
      – In the first row of the helper column, enter the formula:
      “`excel
      =MOD(ROW(), N)
      “`
      Replace `N` with the step interval (e.g., 2 for every second row, 3 for every third row).

      2. **Drag the Formula Down**:
      – Copy the formula down the helper column for all rows in your data.

      3. **Filter by Helper Column**:
      – Select the helper column and apply a filter (`Ctrl + Shift + L`).
      – Filter for rows where the result equals `0` (e.g., to select every Nth row).

      4. **Select Entire Rows**:
      – Once filtered, you can highlight the visible rows and perform your desired operation.

      —

      ### **Method 2: VBA Macro to Select Every Nth Row**
      If you want to automate the selection of every Nth row, use this VBA macro:

      1. **Open VBA Editor**:
      – Press `Alt + F11` to open the VBA editor.
      – Click `Insert` > `Module`.

      2. **Insert the Code**:
      Copy and paste the following VBA code:
      “`vba
      Sub SelectEveryNthRow()
      Dim ws As Worksheet
      Dim n As Long
      Dim i As Long
      Dim lastRow As Long

      ‘ Set the interval for selecting rows (e.g., every 3rd row)
      n = 3

      ‘ Set the worksheet
      Set ws = ActiveSheet

      ‘ Get the last row in the sheet
      lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

      ‘ Loop through every Nth row and select
      For i = 1 To lastRow Step n
      ws.Rows(i).Select
      ‘ Uncomment the next line to add rows to selection
      ‘ ws.Rows(i).EntireRow.Select Replace:=False
      Next i
      End Sub
      “`

      3. **Run the Macro**:
      – Close the VBA editor (`Alt + Q`).
      – Run the macro by pressing `Alt + F8`, selecting `SelectEveryNthRow`, and clicking `Run`.

      —

      ### **Method 3: Conditional Formatting (For Highlighting Every Nth Row)**
      If you only need to **highlight every Nth row**:
      1. Select your entire range of data.
      2. Go to `Home` > `Conditional Formatting` > `New Rule`.
      3. Use a formula to determine which rows to format:
      “`excel
      =MOD(ROW(), N) = 0
      “`
      Replace `N` with your desired interval.
      4. Set the format (e.g., fill color) and click `OK`.

      —

Leave a Reply

Your email address will not be published. Required fields are marked *