How To Insert Every Nth Row

2016-12-27

Follow Along With This Workbook

If you ever need to insert multiple blank rows into your data, doing it manually could be very time consuming if you have a large data set. Here’s a quick way to do this by inserting a blank row into your data after every Nth record.

 

 

I realize it’s a bit of cluster bomb and I might have put a bit too much in it 🙁 To accomplish our task we’re going to need to add a helper column.

  1. Add a column to the right of your data. If the helper column is in E1, then add this formula into E2 and copy it down to the end of the data. Change N to a number (5 if you want every 5th row etc…).
    =MOD(ROW(E2)-ROW($E$1)-1,N)

    Now highlight the whole column.

  2. Go to the Home tab in the ribbon.
  3. In the Editing section, press the Find & Select button.
  4. In the drop down menu, select Find. You can also use the Ctrl + F keyboard shortcut to open the Find and Replace window.
  5. In the Find what input type in 0.
  6. Press the Options button to reveal the advanced search options.
  7. Select Sheet from the Within drop down list.
  8. Select Values from the Look in drop down menu.
  9. Press the Find All button.
  10. Select all the results by pressing Ctrl + A.
  11. Press the Close button.

 

 

All the zero’s in our helper column should now be selected and we can now insert our rows.

  1. Left click on one of the selected cells.
  2. Select Insert in from the menu.
  3. Select Entire row.
  4. Press the OK button.

 

 

Sweet, now we’ve got a blank row every Nth record.

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Subscribe

Advertisement

Related Articles

37 Awesome Excel Mouse Tips & Tricks You Should Know

37 Awesome Excel Mouse Tips & Tricks You Should Know

While the keyboard is generally quicker, you shouldn’t completely ignore the mouse. There are also some great time saving mouse shortcuts as well. In this post we’ll take a look at some of the best Excel mouse time saving tips and tricks.

read more
25 Amazing Power Query Tips and Tricks

25 Amazing Power Query Tips and Tricks

Power query is amazing tool that allows you to import and transform data with ease and helps to create repeatable and robust procedures with your data. Here are some tips and tricks to help you get the most out Power Query.

read more

Comments

16 Comments

  1. Jack

    This is great, however you need to copy the column that has 0-3 and paste it into another column as values. Otherwise it highlights Rows with a zero in the formula such as 10 20 30 etc
    Otherwise this worked perfectly. Thank you for putting it together.

    • John

      Good point. Step 8 should read Values instead of Formula. My picture was correct but the text was wrong. I’ve updated with the correction. Thanks for pointing this out!

  2. Sarah

    How would this work if you need to insert a row every 1000 rows? This highlights ALL cells with a 0 in it which does not really help.
    Is there a modification I can use in the formula?
    Thank you for any help ?

    • John

      Try wrapping the formula in an if function.

      =IF(MOD(ROW(E2)-ROW($E$1)-1,N)=0,0,1)

      • Sarah

        That worked great! Thank you so much!!

  3. Chris Wagner

    Thanks so much! Worked like a charm.

    • John

      Good to hear!

  4. Nick Melvin

    How would you work this for a new row after every entry? I tried changing the N to 1 and when I try to insert the new cells, it just pastes the new cells in one block on top of the existing entries, but they are not interspersed every other one.

    • John

      For every other row, you need N=2.

      • Mark P

        I changed N=2 but it only allowed me to insert a row after every two rows instead of every other row.
        I used the following formula: =MOD(ROW(E2)-ROW($E$1)-1,2) and then pasted this formula into every cell below.

  5. Anferad

    Hi, I tried to insert an empty row after any row with data using MOD function which highlights ALL cells with zero (with N=1). If i replace N=2 shows 0,1,0,1 etc, inserts first empty row above first row with data and then inserts an empty row after 2 rows with data. What i’m doing wrong?
    Thank you.

  6. William

    You show right-clicking to insert, but say to left-click.

  7. Shannon

    Thanks so much 🙂

    • John

      No problem Shannon, glad it helped!

  8. Chriss

    What if you want to insert two new rows after every 12 row. Is there other possibilities to achieve this other than doing what you already mentioned, two times.

  9. Karthik

    Thats a cool tip!

Get The Latest News

Follow Us

Follow us on social media to stay up to date with the latest tips in Excel!

Pin It on Pinterest

Share This