+ Reply to Thread
Results 1 to 13 of 13

I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

  1. #1
    Registered User
    Join Date
    03-14-2021
    Location
    Asia
    MS-Off Ver
    2016
    Posts
    21

    I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    E.g. I want to remove row 2 to 6, 8 to 12 and so on until the end of file.
    Please advice.
    Row 1,7,13 etc will retain.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,359

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    In Sheet2

    in A!

    =INDEX(Initial!A$1:A$18,(ROWS($1:1)-1)*6+1)

    Copy across and down

  3. #3
    Registered User
    Join Date
    03-14-2021
    Location
    Asia
    MS-Off Ver
    2016
    Posts
    21

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Sorry bro but can you explain the commands?
    Because it is an entire excel sheet and this is just sample.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,359

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    For large range use

    =INDEX(Initial!A:A,(ROWS($1:1)-1)*6+1)

    INDEX function is INDEX(range, row #, column #)


    =INDEX(Initial!A$1:A$18,(ROWS($1:1)-1)*6+1)


    (ROWS($1:1)-1)*6+1 calculates the row number

    ROWS($1:1) is "counter" which in increase by 1 as you drag the formula down the rows

    rows($1:1) =1, rows($1:2) =2 which when applied to the above selects row 1, 7,13 etc

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,625

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Here is the macro code to delete rows.
    Row 1--> Headers
    Row2--> Data up to last row

    FR=2
    LR= last row
    Code
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Registered User
    Join Date
    03-14-2021
    Location
    Asia
    MS-Off Ver
    2016
    Posts
    21

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Hi,
    I analyzed the formula and I got 3 questions.

    Q1 What is the difference between putting INDEX(A$1:A$18, row_num) and INDEX(Initial!A$18:A$18, row_num)?
    What does the initial! do ?

    Q2 Can I put INDEX(A$1:B$18, row_num) ? In the words, it is array from A to B, If so how should I edit the formula?

    Q3 Is there a way to drag excel formula down automatically instead of using a mouse?
    Thanks.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,359

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Q1. "Initial" is the Sheet name! where you want to extract the data from

    Q2. It would not achieve anything: put formula in A2 drag to B (so formula in B will be =INDEX(Initial!B:B,(ROWS($1:1)-1)*6+1)

    Select both columns and drag down.

    Q3: if Q2. is too difficult, use the VBA solution ; this deletes from "Initial" so once it has run you have lost the original data.

  8. #8
    Registered User
    Join Date
    03-14-2021
    Location
    Asia
    MS-Off Ver
    2016
    Posts
    21

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Thank you for replying.
    What is the syntax for the sheet name may I ask?

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,359

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Sheet (Tab) name followed by "!" so

    Sheet1! A1

    Sheet2!:A2:B4

    If name includes blanks or special characters e,g "My Sheet"

    then tab name is in single quotes ..

    'My sheet'!A2:Z50

  10. #10
    Registered User
    Join Date
    03-14-2021
    Location
    Asia
    MS-Off Ver
    2016
    Posts
    21

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Thanks this forum is very informative.
    Can I NOT put the sheet name instead?
    If not, how does the formula know which sheet to select?

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,359

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    All explained in post #9. In a formula, it is the name given to a sheet. Excel by default names sheets as Sheet1, Sheet2 etc. If you rename them , then use this name.

    There are numerous on-line Excel courses which will help you get started.

  12. #12
    Registered User
    Join Date
    03-14-2021
    Location
    Asia
    MS-Off Ver
    2016
    Posts
    21

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    I understand. But if I dont put the sheet name, it will just refer to the current excel sheet I am editing right?

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,359

    Re: I want to Remove every 5 rows from my excel sheet. Is there a way to automate it?

    Correct! It will assume the sheet in which the formula is placed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to automate copying certain rows from a sheet to many other sheets?
    By plumberef in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-05-2020, 09:25 AM
  2. [SOLVED] Remove Rows based upon list of search terms, copy removed rows to new sheet
    By sam103329 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-19-2015, 08:47 PM
  3. Remove Rows based upon list of search terms, copy removed rows to new sheet
    By sam103329 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-26-2013, 10:32 PM
  4. Replies: 4
    Last Post: 08-12-2013, 01:35 PM
  5. excel macro to remove specific columns and rows + remove duplicate
    By garrywelson in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-17-2013, 12:03 PM
  6. Macro to Automate Transpose column to rows Excel 2010
    By Rayb1969 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2012, 06:51 PM
  7. [SOLVED] Automate display/ hide rows in excel based on yes/no check box
    By schraplau in forum Excel General
    Replies: 0
    Last Post: 04-25-2006, 02:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1