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 Expert Prashanth KV is a Diamond Product Expert in Google Sheets, officially recognized by Google for his contributions to the Docs Editors Help Community and featured in the Google Product Experts Directory. Explore his blog to learn advanced formulas, automation tips, and problem-solving techniques to elevate your spreadsheet skills.

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

Mode of Comma-Separated Numbers in Excel (Dynamic Array)

There is no dedicated function in Excel to directly find the mode of comma-separated...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

More like this

Calculate Trip Days by Month (Start, End, and Full Days) in Google Sheets

If you're managing business travel in Google Sheets, you may need to calculate how...

How to Find Mode of Comma-Separated Numbers in Google Sheets

Working with comma-separated numbers inside a single cell is a common scenario in Google...

How to Count Merged Cells in Google Sheets (and Get Their Size)

Sometimes, you may have blocks of merged cells in a column or row. But...

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.