+ Reply to Thread
Results 1 to 9 of 9

VBA for Insert Rows based off Matching Values

  1. #1
    Registered User
    Join Date
    06-18-2019
    Location
    Dallas, Texas
    MS-Off Ver
    windows 2013
    Posts
    72

    VBA for Insert Rows based off Matching Values

    Hi! I am attaching a file to help better explain -

    I have a sheet that I am trying to figure out - After I run a quick macro to clean up the data, I am left with all of these values that I need to go thru and sum for a report

    First, I need to insert cells based off 2 columns matching so I have an IF Statement ( I have this done on the sheet in col Q), the IF Statement produces the word "DELETE" when False which tells you when to insert a row below. If Col G2 matches Col G3 and if D2 matches D3 then keep going, if not then insert row below delete (since the code and desc are no longer the same). I will prob eventually try to convert that IF statment to insert via VBA

    Next after rows are inserted, I need to sum all values from Col F but only for those that are within the groups based off the inserted rows (seen on Sheet2)

    You will see on Sheet 1 how this looks "raw" and on Sheet 2 you will see how I inserted rows/summed

    Any help would be greatly appreciated
    EXample Book.xlsx
    Last edited by Tgbell; 01-12-2023 at 03:23 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-29-2022
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    430

    Re: VBA for Insert Rows based off Matching Values

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-18-2019
    Location
    Dallas, Texas
    MS-Off Ver
    windows 2013
    Posts
    72

    Re: VBA for Insert Rows based off Matching Values

    Hi! Sorry, could you provide a little detail and explanation to help me understand what is going on specificlly.

    I see the match for Col D but also needs to match Col G

    My apologies, my vba is a little weak.
    Last edited by Tgbell; 01-11-2023 at 01:46 PM.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: VBA for Insert Rows based off Matching Values

    With this macro you don't need the formulas in column Q or the data in column R.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    Registered User
    Join Date
    06-18-2019
    Location
    Dallas, Texas
    MS-Off Ver
    windows 2013
    Posts
    72

    Re: VBA for Insert Rows based off Matching Values

    Thank you!

    How would you add that to be bolded?

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: VBA for Insert Rows based off Matching Values

    Try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-18-2019
    Location
    Dallas, Texas
    MS-Off Ver
    windows 2013
    Posts
    72

    Re: VBA for Insert Rows based off Matching Values

    Thanks!! May have addtl questions but closing for now

  8. #8
    Registered User
    Join Date
    06-18-2019
    Location
    Dallas, Texas
    MS-Off Ver
    windows 2013
    Posts
    72

    Re: VBA for Insert Rows based off Matching Values

    In regards to the VBA help you provided earlier. I went ahead and marked it solved but I have two addtl questions if you dont mind me asking.

    How could I delete certain rows that have a certain value in Col B? The value is YOGLP and anything that has that needs to be removed

    Also, would it be possible to show formula? I like how it is rn but could be nice to have it show the formula as opposed to count


    The main concern is the Delete any row for Col B: YOGLP
    Attached Files Attached Files

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: VBA for Insert Rows based off Matching Values

    Try:
    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)

Similar Threads

  1. [SOLVED] insert three columns and bring the values based on matching with two workbooks
    By leap out in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-28-2021, 05:57 AM
  2. [SOLVED] Looking to copy certain cells from rows based on matching values
    By djacks in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-10-2019, 10:18 AM
  3. [SOLVED] how to insert empty rows based on column B cell values and paste above values with macro?
    By genetist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2018, 11:47 AM
  4. Align Rows based on Matching Values in 2 Columns
    By cmv040 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-05-2016, 07:49 PM
  5. Insert rows based on count and fill rows with adjacent values
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2015, 02:57 PM
  6. [SOLVED] VBA to Insert Blank Row based on matching values
    By nirvehex in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-29-2015, 04:36 PM
  7. Match values and insert rows for non-matching values
    By Portmanteau in forum Excel General
    Replies: 1
    Last Post: 04-28-2009, 02:08 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