+ Reply to Thread
Results 1 to 4 of 4

Delete multiple rows to reduce size of large spreadsheet

  1. #1
    Registered User
    Join Date
    10-01-2011
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    2

    Delete multiple rows to reduce size of large spreadsheet

    I am working with some very large spreadsheets that have dozens of columns of data collected at one-minute intervals (each row is one minute). I have many days worth of data and these big spreadsheets are cumbersome to work with, so I would like to delete 14 out of every 15 rows so that I end up with data every 15 minutes. In some cases there is already 15-minute data at the top of the sheet, and 1-minute data at the bottom of the sheet, so I would like to select a cell where I want the macro to start and let it work its way down from there.

    I have spent a few hours trying to crack this nut and all I can post is the code from when I record a macro that repeated the delete process twice:

    Please Login or Register  to view this content.
    I am humbled by your knowledge and expertise.

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile Re: Delete multiple rows to reduce size of large spreadsheet

    Good afternoon The Geologist

    ...and welcome to the forum!!

    OK. First, it's impossible to give you a complete answer without seeing a couple of dozen rows of the data you are trying to reduce. For example, if one of the columns of data is time, could you not extract the minute value, and sort by minute, and delete everything that is not 00, 15, 30 or 45?

    In this case a macro may not be the best option, but if you do it via macro, if you are deleting rows, the best idea is to start at the bottom of the sheet ands work upwards.

    Try posting a workbook with a few dozen rows so we can see what you are dealing with.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Registered User
    Join Date
    10-01-2011
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Delete multiple rows to reduce size of large spreadsheet

    Hi Dominic,

    The project I am working on is potentially confidential and while any data I posted would be almost certainly meaningless to anyone, I don't think it would be a good idea to post any of it on a public forum. I don't want to sort by time value because these are time-series data and the order of the rows can not be disturbed, only the essentially redundant data that is collected at a higher frequency than I need.

    These are water level data from dozens of wells collected by datalogging pressure transducers. Column A is the date and time value for each reading (one row per minute over more than 10 days), column B is elapsed time since datalogging started, then each well gets three columns of data for pressure, temperature and water elevation in the well. There are dozens of wells equipped with dataloggers, all collecting three values every minute. You can see how these spreadsheets can grow enormous after a week or two of data have been collected. I use these data to prepare hydrographs...a time-series plot of water elevation changes over time at each well. The large files have been crashing Excel regularly, so I want to delete 14 out of ever 15 rows to effectively get data at 15-minute intervals rather than 1-minute intervals.

    Not to worry, I did this by brute force method and got the desired result last night by simply pasting the last two lines of code multiple times into my macro and running the macro until it had gone through all the data...just took me a few minutes per sheet. Not as elegant a solution as I would have liked, but it did work and, more importantly, I learned something in the process.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Delete multiple rows to reduce size of large spreadsheet

    The Geologist,

    You do not have to paste the lines of code again and again. You can use this code -

    Please Login or Register  to view this content.

+ 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