+ Reply to Thread
Results 1 to 4 of 4

Compare Values in 2 columns and Copy the entire row upon match

  1. #1
    Registered User
    Join Date
    09-13-2010
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    2

    Compare Values in 2 columns and Copy the entire row upon match

    Hello

    I have 2 worksheets, WS1 & WS2:
    WS1 has 1 column (with total 41253 rows) & WS2 has 3 columns (with total 25938 rows)

    I am trying to write a formula (or a macro) to take each value in WS1 and lookup in first col (Column A ) in WS2 - and if i find it copy that particular entire row from WS2 and paste it in a new sheet (lets call it WS3) and continue to do so to the rest in WS1

    with an end result of 41253 rows and 3 columns in WS3

    (see attachment)

    Hopefully you help me with this.
    Thanks in advance
    Last edited by tachytank; 04-07-2011 at 01:22 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Compare Values in 2 columns and Copy the entire row upon match

    1) Select Sheet 1
    2) Right Click Sheet tab and slect to copy sheet
    3) The new copy is going to be the new sheet3

    4) The values in column A of new sheet are Strings while in Sheet 2 are numbers so
    we must convert them to numbers so that vlookup will work
    4b) in an empty cell type the number 1
    4c) select the cell with number one and rt click and select copy
    4d) select all of column 1 , of new sheet, and rt click and select paste special
    4e) in select special window select "value" AND "multply"
    4f) clicking OK will turn strings to numbers

    5) New sheet Column B formula =VLOOKUP($A2,Sheet2!$A:$C,2,FALSE)
    6) New Sheet Column C formula =VLOOKUP($A2,Sheet2!$A:$C,3,FALSE)

    7) Sort by column B to put all n/a's together ... and delete them
    Last edited by nimrod; 04-07-2011 at 12:53 AM.

  3. #3
    Registered User
    Join Date
    09-13-2010
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Compare Values in 2 columns and Copy the entire row upon match

    nimrod ... it works like a charm.
    Thanks so much for the response !!!
    Appreciate all the support ! (not sure how i can repay back !!)

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Compare Values in 2 columns and Copy the entire row upon match

    Your appreciation is reward enough ... glad I could help

+ 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