+ Reply to Thread
Results 1 to 13 of 13

how to delete every 2nd and 3rd row?

  1. #1
    Registered User
    Join Date
    04-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    38

    how to delete every 2nd and 3rd row?

    hello, I have some data in a single column, I need to delete every 2nd and 3rd, that is to reduce the amount of data by 2/3. How can I that in office 2010? can you tell me a non-VBA/macro way?

    Thanks.
    Last edited by warakawa; 05-13-2011 at 07:25 PM.
    Microsoft Excel 2010 32-bit and Windows 7 64-bit on Thinkpad X200T

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: how to delete every 2nd and 3rd row?

    Please Login or Register  to view this content.
    The formula in B2 and down is

    =IF(MOD(ROWS(B$1:B2)-2,3)=0, ROW(), 0)

    Copy col B, replace with values, sort everything by col B, then delete the rows with 0.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    04-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: how to delete every 2nd and 3rd row?

    I have absolutely no idea.... :' (

    if you'd be so kind can you do it for me?
    Attached Files Attached Files
    Last edited by warakawa; 05-13-2011 at 06:01 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: how to delete every 2nd and 3rd row?

    You don't have a header row, so in B1, enter the formula

    =IF(MOD(ROW()-1, 3)=0, ROW(), 0)

    Copy that all the way down.

    Click the Home tab, select col B, click Copy, click Paste > Paste Values

    Click the Data tab, select columns A and B, click Sort, select Column B in the dropdown, and press OK.

    Then delete all the rows that have a 0 in col B.

  5. #5
    Registered User
    Join Date
    04-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: how to delete every 2nd and 3rd row?

    I tried my best, this is what I got...
    Attached Files Attached Files

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: how to delete every 2nd and 3rd row?

    Now just select and delete rows 1:332 and you're done.

  7. #7
    Registered User
    Join Date
    04-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: how to delete every 2nd and 3rd row?

    are you sure shg?

    the data in column B are not my data, they are row numbers, just scroll down and see! And also column B is in ascending order, I need the data to be in the original order because it is time series data.

    edit: can you just do it for me, I need this data asap because I have assignment due soon, I promise I will comeback and learn to do it myself after and I will also promise to learn VBA.
    Last edited by warakawa; 05-13-2011 at 06:41 PM.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: how to delete every 2nd and 3rd row?

    If you follow the steps in the exact order I gave you, you have the surviving data in the original order. I'll convince you.

    Add the formula in B1

    In C1, =ROW()

    Copy B1 and C1 down to the end of the data. You'll see this

    Please Login or Register  to view this content.
    Copy columns B and C and replace with values (looks the same as above, but there are no formulas left.)

    Sort everything by col B:

    Please Login or Register  to view this content.
    Delete all the rows that have a 0 in col B (which is the first 332), leaving

    Please Login or Register  to view this content.
    Note the pattern of the original row numbers in columns B and C.

  9. #9
    Registered User
    Join Date
    04-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: how to delete every 2nd and 3rd row?

    Ohhhhhhhhhhhhhhhhhhhhh!!!!!!!

    I actually got it in book2-1, I was slow when you said delete row 1:332. lol

    Thanks man you're a legend.
    Last edited by warakawa; 05-13-2011 at 07:24 PM.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: how to delete every 2nd and 3rd row?

    Dawn cometh. Good job.

  11. #11
    Registered User
    Join Date
    04-17-2010
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: how to delete every 2nd and 3rd row?

    shg

    off topic question, how can I add an avatar?

  12. #12
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: how to delete every 2nd and 3rd row?

    From the Forum Rules page...

    Once you have been registered for 60 days and posted 100 posts your user title will change from Registered User to Forum Contributor, you will be able to upload a non-animated avatar. When you get to 120 days registered and 200 posts, your title will change to Valued Forum Contributor and you will be able to upload an animated avatar. When your title reaches Forum Guru you can upload a profile picture, we will leave you to wonder how long you have to be registered and how many posts for that!.
    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  13. #13
    Registered User
    Join Date
    08-26-2013
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2011
    Posts
    1

    Re: how to delete every 2nd and 3rd row?

    Thank you very much for this formula and explanation.

    I realize it is over 5 years since you posted it, but it helped me today.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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