+ Reply to Thread
Results 1 to 11 of 11

compare two files and match id

Hybrid View

  1. #1
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    compare two files and match id

    hello please see the attached documents.

    I want to compare the colour column in book1 to the colour column in book 2. If I find a match I want to take the id from book1 and port them over to book2. How do I go about doing this?
    Attached Files Attached Files
    Last edited by ebbo; 11-12-2009 at 06:30 AM.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: compare two files and match id

    With both workbooks open:

    in Book2, cell B2 and copy down

    =INDEX([Book1.xls]Sheet1!$A$2:$B$11,MATCH(A2,[Book1.xls]Sheet1!$B$2:$B$11,0),1)

    Book1 can be closed, the formula still works and the formula will then show the complete path name.

    hth

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: compare two files and match id

    with both workbooks open use in book 2 b2 dragged down
    =INDEX('[Book1(1).xls]Sheet1'!$A$1:$A$200,MATCH(A2,'[Book1(1).xls]Sheet1'!$B$1:$B$200,0))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: compare two files and match id

    See? two people at opposite ends of the world with (almost) identical solutions. At least the approach is the same.

    Martin, you must have had a file called Book1.xls in the folder already when you downloaded the attachment, hence the Book1(1).xls name, right?

  5. #5
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: compare two files and match id

    thanks both of you, both are working!

    Now a further 2 questions.

    1) When dragged down, those rows that do not have a id assigned appear as #N/A. How can I just have these as blank?

    2) The formula obviously connects book1 and book2. So i assume if I delete book1 then book2 will fail.

    After I have got the values I want in book2 I dont actually want to keep a link between the files. I just want the data standalone in book2 - how do i go about doing this?
    Last edited by ebbo; 11-12-2009 at 06:16 AM.

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: compare two files and match id

    1) When dragged down those rows that do not have a id assign appear as #N/A. How can I just have these as blank.
    Let's take Martin's formula and add error checking

    =IF(ISNA(MATCH(A2,'[Book1.xls]Sheet1'!$B$1:$B$200,0)),"",INDEX('[Book1.xls]Sheet1'!$A$1:$A$200,MATCH(A2,'[Book1.xls]Sheet1'!$B$1:$B$200,0)))

    2) The formula obviously connects book1 and book2. So i assume if I delete book1 then book2 will fail.
    Correct.

    Once you see all the values in Book2, highlight column B, copy, then paste special and select "Values". This will overwrite the formulas with the results of the formulas. Now you can trash Book1 and Book2 will still be good.

    hth

  7. #7
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: compare two files and match id

    excellent tyvm, i will try in a bit

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: compare two files and match id

    tyvm
    ???
    The name is teylyn.
    Last edited by teylyn; 11-12-2009 at 06:58 AM.

  9. #9
    Registered User
    Join Date
    03-17-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    74

    Re: compare two files and match id

    Quote Originally Posted by teylyn View Post
    ???
    The name is teylyn.
    I wasnt quoting your name
    tyvm = Thank you very much!

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: compare two files and match id

    Ahhhh! Some of these acronyms escape the poor non-native speaker of English.

    ty

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: compare two files and match id

    taylynne ( ) yep i did have some other workbooks open and did the function by selecting the ranges rather than manually entering them

+ 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