+ Reply to Thread
Results 1 to 12 of 12

Adding Names to a Column A when they appear in Column B but not A

  1. #1
    Registered User
    Join Date
    07-07-2014
    Location
    United States
    MS-Off Ver
    2010
    Posts
    30

    Adding Names to a Column A when they appear in Column B but not A

    Hello,

    So I have a list of Unique names in Column A of Worksheet 1 as well as a list of names that is in Column A of Worksheet 2. All of the names in Worksheet 1 exist in Worksheet 2, but the list in Worksheet 2 contains duplicate names as well as some names that do not exist on Worksheet 1.

    I need a Macro that can identify all of the names in Worksheet 2 that do not exist in worksheet 1 and add them at the bottom of the list in worksheet 1.

    So far I have been able to compile the list in Worksheet 2 so that a separate sheet displays only the unique values in worksheet 2, but I am not sure how to determine which in this new list do not exist in Worksheet A and proceed to insert those values.

    Thanks,

    Justin Picardi

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding Names to a Column A when they appear in Column B but not A

    Hello Justin,

    This is really a continuation of your previous post here.

    I suggest you change the name of this post to something a little different and mark the previous as solved.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Adding Names to a Column A when they appear in Column B but not A

    Hi Justin,

    Take the names from worksheet 1 into your dictionary and then run the names in worksheet 2 against that dictionary

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Adding Names to a Column A when they appear in Column B but not A

    See next code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  5. #5
    Registered User
    Join Date
    06-12-2015
    Location
    Maryland, USA
    MS-Off Ver
    2010
    Posts
    83

    Re: Adding Names to a Column A when they appear in Column B but not A

    I already replied to you on the 1st thread and I think that was the solution you needed.

    If you need to increment in the list of worksheet1 instead of removing it and creating anew then the following code will do that:

    Please Login or Register  to view this content.
    this code reads all the items in worksheet2 and if the names are unique and not present in worksheet1 it will increment the list on that sheet. This code assumes all your lists start in row1 (both sheet1 list and sheet2 list). If you change the list on sheet2 and re-run the code, it will increment list1. It will not delete the current components of it.

    See if that helps.
    Got help? Pls give rep.
    If you do R&D learn VBA

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Adding Names to a Column A when they appear in Column B but not A

    Copy ColA from Sheet2 and add below the data in Sheet1 Col.A then RemoveDup...
    Assuming both sheets have header in row 1.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-07-2014
    Location
    United States
    MS-Off Ver
    2010
    Posts
    30

    Re: Adding Names to a Column A when they appear in Column B but not A

    Thanks PCI,

    This is the type of thing I am looking for I am just struggling to get it work when the Lists I am trying to work with are both in Row C of their Sheets and there are values in Rows A and B. Are there any Changes I can make to fix this?

    Thanks,
    Justin

  8. #8
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Adding Names to a Column A when they appear in Column B but not A

    re: post# 6 using RemoveDuplicates

    Suppose you have in Sheet 1, Col 1
    HdrOne
    10
    9

    and in Sheet 2, Col 1
    HdrTwo
    10Q
    9


    Or even if the data (i.e. "names") on each sheet are just numbers such as 1 and 2, but formatted differently.

    Using RemoveDuplicates gives me a different result from other removing duplicates approaches such as advanced filter or dictionary object.
    So, how useful is this method and why is it suggested for this type of problem?

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Adding Names to a Column A when they appear in Column B but not A

    Hey Justin,

    How about a sample??

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Adding Names to a Column A when they appear in Column B but not A

    Quote Originally Posted by kalak View Post
    Using RemoveDuplicates gives me a different result from other removing duplicates approaches such as advanced filter or dictionary object.
    So, how useful is this method and why is it suggested for this type of problem?
    No idea about what you are talking about.
    Dictionary also detects data types....

  11. #11
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Adding Names to a Column A when they appear in Column B but not A

    Quote Jindon
    No idea about what you are talking about.
    Dictionary also detects data types....
    Obviously you didn't try it.
    Perhaps you should just try the data I suggested and then report your findings.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Adding Names to a Column A when they appear in Column B but not A

    OK, in that case, remove dups is not working, istead, still no loop requred
    Please Login or Register  to view this content.

+ 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. Replies: 21
    Last Post: 08-18-2014, 06:44 PM
  2. Replies: 3
    Last Post: 11-08-2012, 09:29 PM
  3. Replies: 2
    Last Post: 11-19-2011, 01:14 PM
  4. adding column with corresponding names
    By darkbearpooh1 in forum Excel General
    Replies: 2
    Last Post: 04-07-2009, 02:37 PM
  5. Adding Checkboxes to Form based on how many names in column?
    By BigDubbe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2008, 09:42 AM

Tags for this Thread

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