+ Reply to Thread
Results 1 to 16 of 16

Matching Last Names in Two columns and pick up certain ones

  1. #1
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Matching Last Names in Two columns and pick up certain ones

    Column “A” contains names of authors for papers from a number of organizations in the format
    Last Name, (comma ) then First Name initials

    Column “B” contains the names of authors from a specific organization in the format, generally Last Name; (semicolon) then full first name. In some case, Last Name; (semicolon) first name initials.

    All the names in column “B” are sub set from column “A”.
    The Last Name is common between column “A” and “B”.

    I am looking for a formula in Column “C” that produce the names in the format Last Name, (comma) first initials as in column A for organization X
    The attached file provides sample of the massive data that I have.
    Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Matching Last Names in Two columns and pick up certain ones

    Please Login or Register  to view this content.
    If someone has helped you then please add to their Reputation

  3. #3
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Matching Last Names in Two columns and pick up certain ones

    Dear Pjwhitfield

    Many thanks for your reply.
    Excuse my ignorance, this looks like a macro but I could not run it.

    I copied it as is to "View Code" and run it. It then asked me to give it a name and I did but it did not do any thing in column "C"


    What do I need to do?

    All the best Taisir

    I uploaded the correct file again with a single sheet
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Matching Last Names in two column and choose one

    Dear Friends,

    I am re-posting this request in the VBA section from the “Formula Section”, since I was not able to obtain the right formula to do the job.
    In the attached file,
    Column “A” contains names of authors of papers from a number of organizations in the format Last Name, (comma ) then First Name initials;

    Column “B” contains the names of authors for a specific organization in the format, generally Last Name; (semicolon) then full first name. In some case, Last Name; (semicolon) first name initials.

    All the names in column “B” are sub set from column “A”.
    The Last Name is common between column “A” and “B”.

    I am looking for a formula in Column “C” or a Macro (VBA) that produces the names in Column B in the format Last Name, (comma) first initials as in column "A" for organization X.

    Basically, a formula or a VBA that examines last name in column “B”, then find its match in column “A” and then copy how its written in “A” to column “C”

    The attached file provides sample of the massive data that I have.

    Any help is greatly appreciated.
    Thanks in advance
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Matching Last Names in two column and choose one

    Threads merged
    Last edited by protonLeah; 11-24-2014 at 02:18 AM.
    Ben Van Johnson

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Matching Last Names in Two columns and pick up certain ones

    The macro provided previously is a FUNCTION not a Sub.

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To use the function you type its name just as you do the built-in functions:

    In a cell C2 type:
    Please Login or Register  to view this content.
    and press enter.
    Last edited by protonLeah; 11-24-2014 at 12:56 AM.

  7. #7
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Matching Last Names in Two columns and pick up certain ones

    I have post the solution in another thread in vba section :

    here
    Last edited by karedog; 11-24-2014 at 01:22 AM.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  8. #8
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Matching Last Names in two column and choose one

    Quote Originally Posted by protonLeah View Post
    Welcome to the Forum, unfortunately:
    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    In previous thread in "formulas-and-functions" section, OP realize that this problem is hard to solved using formulas, so he make a new thread in vba section, I think the previous thread is the one which must be closed.



    Quote Originally Posted by Taisir View Post
    Dear Friends,

    I am re-posting this request in the VBA section from the “Formula Section”, since I was not able to obtain the right formula to do the job.
    In the attached file, .....
    Thanks in advance

    Hi,

    Maybe like this ?

    Please Login or Register  to view this content.
    Regards

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Matching Last Names in two column and choose one

    If the other thread needs to be moved to a different forum, that needs to be done in that thread, not have a new thread started.

    Because some work has already been done here, I will merge this 1 with the other 1
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Matching Last Names in two column and choose one

    Dear All

    Many thanks for Karedog for the the VBA that worked perfect. However, I have similar problem which I wonder whether the VBA can be adjusted or a new VBA is needed.

    The attached sheet is a sample of the data that I have and illustrate the problem and the desired outcome.

    Column “A” contains names of authors of papers from a number of organizations in the format Last Name, (comma ) then First Name initials;

    Column “B” contains the affiliations of the same authors of column “A” but in the format Last Name, (comma) then full First Name. In some case, Last Name, (comma) Initials. Authors from the same institutions are separated by semicolon(.
    The Last Name is common between column “A” and “B”.

    Basically, I am looking for a VBA that examines Last Names in column “B” for each author, then find its match in column “A” and then reproduce column “B” in Column “C” with how its written in “A”.

    The attached file provides sample of the massive data that I have.
    Any help is greatly appreciated.
    Thanks in advance
    Attached Files Attached Files

  11. #11
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Matching Last Names in Two columns and pick up certain ones

    Hi,

    Please look at my attached file for the solution.

    Regards
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Matching Last Names in Two columns and pick up certain ones

    Dear Karedog

    I really appreciate your help. I tested the VBA on another sample sheet and worked just fine. Magic

    Will mark this thread as solved. Taisir

  13. #13
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Matching Last Names in Two columns and pick up certain ones

    Dear Karedog again,

    I am trying to run the VBA on the full file and it keeps stopping with Error.

    Can I ask you please to test on the attached.

    My apologies for keep coming back to you.
    Many thanks in advance

    Taisir
    Attached Files Attached Files

  14. #14
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Matching Last Names in Two columns and pick up certain ones

    Dear Taisir,

    The problematic row is row 317. At this row, there is a person whose name is just "Nonappa", while expected format is "Lastname, Firstname/Initial", so this is unexpected for previous code.

    Please use this new code :

    Please Login or Register  to view this content.
    Regards

  15. #15
    Forum Contributor
    Join Date
    10-06-2013
    Location
    Riyadh, Saudi Arabia
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Matching Last Names in Two columns and pick up certain ones

    Many thanks Karedog.
    I will use this macro heavily on hundred of files for different universities in the next few months, I really appreciate the great help.

    I will keep you posted with any difficulty. Take care and all the best

  16. #16
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Matching Last Names in Two columns and pick up certain ones

    You are welcome Taisir, glad I can help. And many thanks for the reputation point.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Matching names from different columns..
    By jkim204 in forum Excel General
    Replies: 3
    Last Post: 08-18-2014, 03:51 PM
  2. Matching Names to Values Using Two Columns
    By Stopwatch in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-23-2014, 11:44 AM
  3. Look up and compare names from two columns, matching issues
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2012, 02:16 PM
  4. how to find matching names in two columns ??
    By jovak in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-18-2007, 05:08 PM
  5. Matching two columns of names in different formats.
    By surplusbc in forum Excel General
    Replies: 0
    Last Post: 03-17-2005, 01:22 AM

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