+ Reply to Thread
Results 1 to 7 of 7

Insert Rows if data is missing from main sheet

  1. #1
    Registered User
    Join Date
    04-20-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    51

    Insert Rows if data is missing from main sheet

    Hello All,

    I am trying to write a formula that will add in 4 extra rows if a number in the check sheet is not in the main sheet and have the same text as the rest in column B with the same formatting. I will describe what is going on in my sample book as an explanation.

    In the main sheet, you have your price, cost and GP and all the accounts that were active in that period. On the check sheet, you have all the accounts in the system that need to be included on the main sheet. I am trying to find a way to do a count to see if all the numbers on tab "Check" are in tab "Main". As you can see, there are 4 that are not. I am trying to write a macro that does a countif and if it is less than 1, insert 4 new rows with that account number and have it display the PRICE, REVENUE and GP like it is formatted in the main tab. It would be great if there was a way to make it insert after the previous number in the series, e.g. 4905 being inserted after 4904 and before 4906.

    Thank you all!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    08-01-2012
    Location
    Montreal, Qc, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Insert Rows if data is missing from main sheet

    Good Morning,


    I would do something like this


    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Insert Rows if data is missing from main sheet

    Try,
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Insert Rows if data is missing from main sheet

    Try this:

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Insert Rows if data is missing from main sheet

    Maybe:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-20-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    51

    Re: Insert Rows if data is missing from main sheet

    Stnkynts, yours seems to work pretty well. It inserted it into the correct rows but when it hit the 5000s it started to go from the upper numbers to the lower, e.g. 5905, 5904, 5903.... instead of 5903, 5904, 5905

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Insert Rows if data is missing from main sheet

    Quote Originally Posted by SAFC View Post
    Stnkynts, yours seems to work pretty well. It inserted it into the correct rows but when it hit the 5000s it started to go from the upper numbers to the lower, e.g. 5905, 5904, 5903.... instead of 5903, 5904, 5905
    It doesn't do that for me. Whatever the order on the check sheet is the order which it will become on the main sheet

+ 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] Compare two columns on separate sheet, if missing, insert missing data
    By lilvictorians in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-03-2019, 11:44 PM
  2. Insert/Delete rows based on the same numbers of rows with data in other sheet
    By Blokeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2015, 08:28 PM
  3. [SOLVED] How to insert no. of rows under main rows according to no. of family members....?
    By Indra Rai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2014, 09:04 AM
  4. Macro to insert rows for missing data
    By jebucher in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2012, 11:49 PM
  5. Matching multiple rows and if no match insert missing data
    By Master8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2012, 12:35 PM
  6. [SOLVED] VBA to create multiple worksheets, rename, and insert information all off main sheet ...
    By headstrong2740 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-03-2012, 10:24 AM
  7. Selectively insert missing data rows - Need help ASAP!!
    By senneking in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2011, 09:27 PM

Tags for this Thread

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