+ Reply to Thread
Results 1 to 6 of 6

Insert Rows, based on values in a column, for a 300,000 row dataset

  1. #1
    Registered User
    Join Date
    01-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    34

    Insert Rows, based on values in a column, for a 300,000 row dataset

    Hi,
    This is what I'm trying to do:
    1. Check the values in column A, if they are equal, AND
    2. The sequential order of values in column B is either 6 then 7, or 2 then 6
    3. THEN insert a row, AND
    4. Enter the same column A value, AND the value "3" in column B

    Please see attached spreadsheet.

    Anthony from this forum has written a code (see macro in the spreadsheet) that works great, but only for a data set up to 15,000 rows. When I try to use it on my data set that has over 300,000 rows, it crashes. Is there a way to change the code to handle a large number of rows?

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Insert Rows, based on values in a column, for a 300,000 row dataset

    engineerlady,

    Thanks for the workbook.

    I expanded the data in Sheet1 down to row 10,401.

    Your original macro and function took 30.766 seconds.

    The below macro took 14.047 seconds.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.

    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm


    Then run the Find6 macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Insert Rows, based on values in a column, for a 300,000 row dataset

    engineerlady,

    I missed this part "2. The sequential order of values in column B is either 6 then 7, or 2 then 6"

    Be back later.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Insert Rows, based on values in a column, for a 300,000 row dataset

    engineerlady,

    Thanks for the workbook.

    I expanded the data in Sheet1 down to row 10,401.

    Your original macro and function took 30.766 seconds.

    The below new macro took 9.922 seconds.


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


    Please Login or Register  to view this content.

    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm


    Then run the Find6V2 macro.

  5. #5
    Registered User
    Join Date
    01-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: Insert Rows, based on values in a column, for a 300,000 row dataset

    Thank you Stan!!! I really appreciate you working on this, it will help me out greatly!! Thanks Have a great day!

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Insert Rows, based on values in a column, for a 300,000 row dataset

    engineerlady,

    You are very welcome. Glad I could help.

    Thanks for the feedback.

    Come back anytime.

+ 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