+ Reply to Thread
Results 1 to 4 of 4

Copy Rows if first cell matches criteria

  1. #1
    Registered User
    Join Date
    08-28-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    16

    Copy Rows if first cell matches criteria

    Hi everybody,

    I am trying to copy a report together in a result worksheet which is based on two input worksheets.

    What I have is Input_Worksheet1 which could look like

    RP_ID | ER_ID | Num
    rp1 | er1 | 123
    rp2 | er2 | 321
    rp1 | er3 | 99

    Input_Worksheet2:

    RP_ID | Num
    rp1 | 222
    rp2 | 321

    The Output I am trying to achieve is

    RP_ID | ER_ID | Num
    rp1 | sum | 222
    rp1 | er1 | 123
    rp1 | er3 | 99
    rp2 | sum | 321
    rp2 | er2 | 321


    So I am trying to create a function which
    1) goes to input worksheet 2
    1a) copies the first row to the output worksheet
    1b) saves the value of the first cell (in column A) in a temp variable "criterion"
    2) goes to input worksheet 1
    2b) copies all rows to the output worksheet
    2b_?) where the first cell of the row is equal to the saved variable "criterion"
    3) Starts over at (1) with the 2nd row of that input worksheet

    The code I have found for copying stuff is not really working with dynamic criteria and I can't seem to be able to adapt it fittingly.

    Does any of you have suggestions on how to tackle this?

    Thank you very much!

    Best regards,
    Andreas
    Last edited by amq; 08-30-2012 at 10:41 AM. Reason: Solved

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Copy Rows if first cell matches criteria

    Possibly...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-28-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Copy Rows if first cell matches criteria

    Thank you very much for your help! Problem solved :-).

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Copy Rows if first cell matches criteria

    You're welcome! Glad it helped.

+ 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