HomeGoogle DocsSpreadsheetDelete Every Nth Row in Google Sheets Using Filters

Delete Every Nth Row in Google Sheets Using Filters

Published on

I’ve seen many users using a helper column to mark and delete every nth row in Google Sheets. But the fact is that we can do that without using a helper column. By saying helper column, I mean a supporting column.

I will explain to you, without using a helper column how can we remove every nth row in Google Docs Sheets.

Actually, it’s quite easy to delete every nth row in Google Sheets using the Filters (Data > Create a filter) custom formula feature.

You May Like: Filter Unique Values Using the Filter Menu in Google Sheets.

Here is that quick tip to filter and remove every nth row in Google Sheets. Before that one question, that you may possibly want to ask me.

Why do you want to delete every nth row in Google Sheets?

I want to delete every 4th rows in one of my tables in Google Sheets since those rows contain some labels. Do you know why?

I don’t want those labels present, as it can (mixed content) cause issues in other Spreadsheet formulas like Query.

If you are not familiar with the term “mixed content data” see the sample data below. There are labels between numeric data that makes all the columns mixed type.

Demo data to delete every nth row in Google Sheets

How to Filter and Delete Every Nth Row in Google Sheets

First I’ll explain how to filter and delete every 4th row in Google Sheets. After that, I will share with you how to use the 4th row as nth.

Set up Filters in Google Docs Sheets

First of all, select the data range. I have data in the range A2:C19 and I’ve selected that range. Then go to the “Data” menu and click on “Create a filter”. This action will create a Filter drop down in your Google Spreadsheet file.

In the second step, we want to insert the custom Filter formula in the designated field inside Filters. How to do that.

To key in the custom formula in the Filter views, do as follows.

  • Click on the drop-down in the first column (Cell A2).
  • Then click on the “Filter by condition”.
  • Lastly, select the “Custom formula is”.

Still having any doubt? See the GIF screenshot below.

How to apply custom filter formula in Docs Sheets for deleting rows

Now time to key in the custom filters formula to filter every 4th row.

Custom Formula Rule to Filter Every nth Row in Google Docs Sheets

Enter the below MOD formula in the provided field and click OK.

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

This filters only the rows that contain the labels. That means you can now only see every 4th rows in your data range.

every 4th row filtered and waiting to delete

Now select the rows 6, 10, 14 and 18 and right click and delete the rows. That’s all. Now you can remove the filter from the Data menu (Turn off filter). The Alt+D+F shortcut keys will also work.

See that all the labels have gone and you have clean data now. I didn’t delete the first row, that also you can delete.

data cleaning with filter in Sheets

How to Change the 4th Row to nth Row in the Custom Formula?

This is very important to know. First go thru’ the following formulas and try to understand the pattern.

The custom formula to delete every 2nd row:

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

The custom formula to delete every 3rd row:

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

I have already used the custom formula for the 4th row which is as follows.

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

Then see this Filters custom formula to delete every 5th row.

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

See the pattern. From this, you can understand one thing.

To filter and delete every nth row in Google Sheets you can use the Filters in Data menu. In that filter use a custom rule formula based on MOD.

In the MOD formula, the divisor represents the nth row number.

MOD(dividend, divisor)

The dividend is the very first cell in the data range. That’s all. Enjoy!

Similar Tutorials:

  1. How to Highlight Every Nth Row or Column in Google Sheets.
  2. How to Sum Every Nth Row in Google Sheets Using SUMIF.
  3. Dynamic Formula to Select Every nth Column in Query in Google Sheets.
  4. How to Copy Every Nth Cell in a Column in Google Sheets.
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.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

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.