+ Reply to Thread
Results 1 to 4 of 4

Copy matching values in range in two columns into another column

  1. #1
    Registered User
    Join Date
    09-22-2015
    Location
    London
    MS-Off Ver
    MS365 Enterprise Version 2310
    Posts
    52

    Copy matching values in range in two columns into another column

    New here and still learning …. seem to have hit a brick wall so back to the board.

    I have tried amending some previous code to give me a different output. Seemed simple enough but I am not getting the desired output and I'm also not sure it's the most efficient method. I think I am making a small error somewhere?

    Basically I have two columns and all I am trying to do is copy any matching/duplicate names in both columns to a new column J. Column I is simply numbered 1,2,3, etc and is dynamically generated.

    The number of candidates in both columns can of course change and is not fixed.

    I've attached my file and would appreciate any help. I can do it in Excel but would like a Excel VBA script to do it.

    Many thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Copy matching values in range in two columns into another column

    Hi F1ash,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    04-19-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Copy matching values in range in two columns into another column

    Thanks Robert - that's a great help and really efficient way of doing it.

    If there was some data at the top of the columns and some more data below both columns, would it be possible to fix the range of the array? Of course this list may change but as long as I can fix the array range then it should not be an issue. I only want the data from the fixed array and not all of the data above and below.

    Sorry I should have been clearer in my original post.

    I've attached the file again so you know what I mean.

    Thanks again
    Attached Files Attached Files
    Last edited by technik; 06-20-2019 at 04:33 AM.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Copy matching values in range in two columns into another column

    Try this where there needs to something on both sides of the name (one way I thought of from looking at the data):

    Please Login or Register  to view this content.
    The revised code will also automatically put in the duplicate number into Col. I.

    Regards,

    Robert

+ 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. [SOLVED] Need to copy values from a range when matching records located in columns a & b
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-04-2018, 07:32 AM
  2. [SOLVED] Matching A Value In One Column With Values In Several Columns
    By artiststevens in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2015, 05:32 AM
  3. Matching values in two columns - one column has duplicates
    By morganz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-08-2015, 10:38 AM
  4. Replies: 4
    Last Post: 03-23-2014, 09:40 AM
  5. Replies: 2
    Last Post: 11-14-2013, 01:44 PM
  6. Replies: 2
    Last Post: 12-30-2011, 07:30 PM
  7. Replies: 8
    Last Post: 12-25-2011, 08:39 PM

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