+ Reply to Thread
Results 1 to 15 of 15

Matching names from sheet2, sheet3, sheet4 with names in sheet1

  1. #1
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Hello again!

    Yesterday guys hellped me out with some problem and now as I move on I got another one, that is connected with the one before, but diferent, so I'm posting new thread.

    I have a workbook (attached at the bottom of post), where in column A there are Data (mixed names and surnames), in column B and C there are cleaned and separated names and surnames, but we still don't know what is what. So in sheet3, 4 and 5 (MaleNames, FemaleNames, Surnames) we have databases of names(M/F) and surnames and my question is if it is possible to lookup every cell from column B and:
    1. compare with male names (sheet3) and if there is a match we copy that name in D (Name Male B)
    2. compare with female names (sheet4) and if there is a match we copy that name in F (Name Female B)
    3. compare with surnames (sheet5) and if there is a match we copy that name in H (Surname B)

    Same lookup and compare we then do for column C only that we copy names in columns E, G, I (Name, Male,Female, Surname C).

    Can please someone can help me with that?

    Thank you guys, you are the best

    Tilen

    Example22.xlsx
    Last edited by Lynx2x; 03-05-2012 at 06:11 AM.

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

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Try in D2:

    =IF(ISNUMBER(MATCH(B2,MaleNames!A:A,0)),B2,"")

    and in E2:

    =IF(ISNUMBER(MATCH(C2,MaleNames!A:A,0)),C2,"")

    repeat for other columns substituting appropriate sheetnames.

    copy alll formulas down
    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
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    First of all thank you for your quick reply.

    Yeah, I've tried using match or VlookUp but then in the cell there is formala and not its value (I know for paste special) and most of all I would like to have that solved in way that when I get a new base of names and surnames and would simply click on a button and macro will compare and copy values in its proper place.
    Hope you know what I mean and I hope it is not to much to ask but you would really help me with that (not just for today...but for everyday )

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

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    If you convert your ImePriimek sheet table into an Excel Table, through Insert|Table, then when you add new names to bottom the formulas will automatically copy down to those rows... and since the MATCH() functions reference the whole columns in the other sheets, you don't need to make any other adjustments. This will avoid having to use VBA.

  5. #5
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Hi.

    Yes, that is all true, and I thank you for that, but I want to have a macro that does this, so everytime I get new uncleaned database, I could clean it with few simple clicks on buttons.

    Can you help me with that?

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

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    I can't help you with VBA.. but others here might be able to.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    This should do the trick:

    Please Login or Register  to view this content.
    If it's a male's name it will be put into column D
    If it's a female's name it will be put into column E
    If it's a surname it will be put into column F

    No need to differentiate any further.
    Attached Files Attached Files
    Last edited by snb; 02-23-2012 at 10:12 AM.



  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    as an option
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Hello guys!

    First of all thank you for your replies and your help, you are really the best.

    Both of codes are great and way beyond my knowledge of VBA codes, so once again I'm very thankfull for that. Although code from user snb is not working as it should, but code from nilem is working great with one little problem. When I add this code to a bigger database is working great until it reaches an empty cell in column B or C. Lets say it reaches the empty cell in column B. When it does it stops comparing names from that column, but it countinoues to compare from column C. Then lets say also one cell in column C is empty programe stops comparing everything.

    Hope you know what I mean and if may I ask you to help me with that. What should I add to the code?

    Thank you in advance!

    Tilen

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    try it
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Yes, it is working perfectly! Thank you very very much. You have made my life much easier !

    Just one more question. Now that I have all this, I've made few macros myself for sorting all these names and surnames and everything is working great, but I've made everything with selection. So if I want to sort surnames I must select all of them from column H and I'm wondering how to do that without selection, so when I click on button it will automaticly know that it must select column H.

    Do you know what I mean? Thanks once again!

  12. #12
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Hello again!

    I have one more question on this topic.

    In some cells A there is NAME, MIDDLE NAME, SURNAME...so three records. What should I change in the code above (from nilem), that programe is comparing and sorting all three records if it is male or female name or surname.

    Any thoughts?

    Thank you very much!

  13. #13
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Mybe it will be easier if I post you some example, to see what I am looking for.

    There is a macro(from nilem) that works fine if there is only one name and one surname. But now in some cells there are two names or surnames and code must lookup all three records and compare it if it is a male name or female name or surname and write it into correct cell.

    hope anyone could help me!

    Thank you very much guys, you are the best!



    Examp01.xlsx

  14. #14
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    try it
    Please Login or Register  to view this content.
    PS The data on sheets 'MaleNames', 'FemaleNames', 'Surnames' should be sorted from A to Z (Podatki o listov "MaleNames", "FemaleNames", "Surnames" je treba razvrstiti od A do Ž)
    Last edited by nilem; 02-28-2012 at 07:31 AM.

  15. #15
    Registered User
    Join Date
    02-21-2012
    Location
    Krsko, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Matching names from sheet2, sheet3, sheet4 with names in sheet1

    Yes, perfect!

    Thank you very very very much. Working perfectly.
    I knew that there is not much to change, but like I said my knowledge of VBA is very poor and you have helped me a lot!

    Have a great day!

+ 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