+ Reply to Thread
Results 1 to 10 of 10

Excel 2007 : Advanced comparing two columns

  1. #1
    Registered User
    Join Date
    05-26-2011
    Location
    123
    MS-Off Ver
    Excel 2003
    Posts
    10

    Exclamation Advanced comparing two columns

    Hi all,

    I am trying for hours and just can't figure it out:

    I have two worksheets:

    1. Worksheet: about 5000 names Column A

    2. Worksheet: about 2000 names in Column A and email adress in Column B

    I want to compare the two columns A and insert the email adress of a found name in Column B of the 1. worksheet.

    One further problem is that some names are there twice in the 2. worksheet with different email addresses.

    Please help!
    Last edited by Moerz77; 06-03-2011 at 06:52 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Comparing to columns

    So if there are duplicates, you want the other email adress displayed in column C?

    Are there ever more than 2 matches?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-26-2011
    Location
    123
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing to columns

    Hey! No there should not be more than 2 matches and duplicated names should also have duplicate entries in email adresses in column A & B in the first worksheet.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Comparing to columns

    Ok since we are working with relatively large amount of data, we should use a helper column to alleviate processing stress....

    So in Sheet2, column C add formula in C2:

    =A2&"_"&COUNTIF(A$2:A2,A2)

    and copy down

    Then in Sheet1, use formula in B2:

    Please Login or Register  to view this content.
    adjust sheet name and ranges to suit and then copy to next column and down the whole list.

  5. #5
    Registered User
    Join Date
    05-26-2011
    Location
    123
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing to columns

    Hi,

    thanks a million, this works in general, but some email-adresses appear twice in Sheet 1 and I noticed some names appear more than twice in Sheet 2 ;(

    Could you help adjust the formular?

    Thanks again for your quick support.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Comparing to columns

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!

  7. #7
    Registered User
    Join Date
    05-26-2011
    Location
    123
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Comparing to columns

    attached is worksheet with your formular and the result.

    In general it works but not quite as needed

    Problem description:Sheet 1: about 5000 names Column A
    Sheet 2: about 2000 names in Column A and email adress in Column B

    I want to compare the two columns A and insert the email adress of a found name in Column B of the 1. worksheet.
    For every name that is found more than once in Sheet 2 there should be the appropriate amount of entries in Sheet 1

    Problem with your formular: Only the first email adress of a duplicated name gets inserted into Sheet 1 column B

    I hope this is understandable
    Attached Files Attached Files

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Comparing to columns

    There are 6 Name1's in Sheet1 and 9 Name1's in Sheet2. Do you want only the first 6 matches of Name1 to be used in Shee1?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Comparing to columns

    If so, then:

    =IFERROR(INDEX(Sheet2!$B$2:$B$6000,MATCH(A2&"_"&COUNTIF(A$2:A2,A2),Sheet2!$C$2:$C$6000,0)),"")

    copied down

  10. #10
    Registered User
    Join Date
    05-26-2011
    Location
    123
    MS-Off Ver
    Excel 2003
    Posts
    10

    Thumbs up Re: Comparing to columns

    Hey! This seems to work great. Somehow in the 2000 results in sheet 1 there were 2 duplicate email addresses - Not sure why...maybe you have an idea?

    Anyway, this was the solution to my problem! Thaaaaanks so much.

+ 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