Delete Every Nth Row in Google Sheets Using Filters

Many users rely on a helper column to mark and delete every nth row in Google Sheets. However, you can do this without a helper column by using the “Create a filter” option in the Data menu.

In this guide, I’ll show you how to delete every second, third, fourth, or nth row in Google Sheets using filters—no scripting or AI required.

Why Delete Every Nth Row in Google Sheets?

I needed to delete every 4th row in one of my tables because those rows contained labels that interfered with other spreadsheet formulas like QUERY. Having labels mixed with numeric data creates mixed content, which can cause issues in formulas that expect uniform data types.

If you’re unfamiliar with mixed content data, see the example below. Labels appear at every 4th row, making the entire column a mixed data type.

Sample dataset showing rows with labels that need to be deleted every nth row in Google Sheets

How to Filter and Delete Every Nth Row in Google Sheets

I’ll first demonstrate how to filter and delete every 4th row. Then, I’ll show how to modify the formula to delete any nth row.

1. Set Up Filters

  1. Click on the first cell in your data range (e.g., A2).
  2. Go to the Data menu and select Create a filter.
  3. Click the filter icon in the first column (cell A2).
  4. Select Filter by condition > Custom formula is.
Animated GIF showing how to enter a custom formula in the 'Create a filter' option in Google Sheets to filter and delete rows

2. Apply a Custom Formula to Filter Every Nth Row

Enter the following MOD formula in the provided field and click OK:

=MOD((ROW(A3)-ROW($A$3)+1), 4)=0

This formula filters only the rows that contain labels (every 4th row in this case). You will now see only the selected nth rows in your dataset.

Filtered dataset displaying only every 4th row, ready for deletion in Google Sheets
Note: The formula should reference the first data row (e.g., A3) rather than the header row. If your data starts from a different row, adjust the reference accordingly.

3. Delete the Filtered Rows

Select the visible rows:

  • To select all filtered rows at once, click on the first visible row number (e.g., row 6), then hold down the Shift key and click the last visible row number (e.g., row 18). This selects all filtered rows in one go.
  • To select rows individually, hold down the Ctrl (Cmd on Mac) key and click each row number one by one (e.g., 6, 10, 14, and 18).

Delete the selected rows:

  • Right-click on any selected row and choose Delete selected rows.

Turn off the filter:

  • Go to the Data menu and click Remove filter, or use the shortcut Alt + D + F.
Cleaned dataset after deleting every nth row using filters in Google Sheets

Modify the Formula to Filter Every Nth Row

To delete a different nth row, modify the formula as follows:

  • Delete every 2nd row:
=MOD((ROW(A3)-ROW($A$3)+1), 2)=0
  • Delete every 3rd row:
=MOD((ROW(A3)-ROW($A$3)+1), 3)=0
  • Delete every 5th row:
=MOD((ROW(A3)-ROW($A$3)+1), 5)=0

The pattern is simple: change the divisor (the number after the comma in MOD) to the nth row number you want to filter.

Summary

To delete every nth row in Google Sheets:

  1. Apply a filter using the “Create a filter” option in the Data menu.
  2. Use a custom formula with MOD to filter every nth row.
  3. Select and delete the filtered rows.

This method is efficient and requires no scripting. You can use it to clean up large datasets quickly.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

How to Break RANK Ties Alphabetically in Google Sheets

The RANK function in Google Sheets is commonly used to assign rankings to numerical...

Google Sheets: Highlight an Entire Column If Any Cell Has an Error

Google Sheets allows you to highlight an entire column if any cell has an...

Filter Top N per Category in Excel (Using FILTER & COUNTIFS)

You can use a combination of FILTER and COUNTIFS to filter the top N...

Rank per Group in Excel

You have two groups of 20 students each. How do you determine the rank...

More like this

How to Break RANK Ties Alphabetically in Google Sheets

The RANK function in Google Sheets is commonly used to assign rankings to numerical...

Google Sheets: Highlight an Entire Column If Any Cell Has an Error

Google Sheets allows you to highlight an entire column if any cell has an...

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

2 COMMENTS

  1. Hello,

    Thank you for this!

    I was wondering if it is possible to delete every 16th and 17th row. I have two nth rows in my custom filter.

    =mod((row (A3)-row($A$3)+1), 16, 17) = 0

    Would this work?

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.