+ Reply to Thread
Results 1 to 9 of 9

Matching columns

  1. #1
    Forum Contributor
    Join Date
    10-21-2010
    Location
    LONDON
    MS-Off Ver
    2007
    Posts
    108

    Matching columns

    Hi!

    I want to create a MACRO so that it gives a option or button to select which column I want to match while comparing SHEET1 with SHEET2.Like FNAME & LNAME or all the columns or any of the 4 columns.The matched rows should get filled in sheet "Result".

    I know vlookUP is there but I do have large sets of data.Attached is the sample worksheet.

    Thanks in advance.


    Lovinguy
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Matching columns

    Hi,
    Try this code :
    You input the column number to compare separated by comma : 1,2,3,...
    use -1 to compare all

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

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

    Re: Matching columns

    Try the attached
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-21-2010
    Location
    LONDON
    MS-Off Ver
    2007
    Posts
    108

    Re: Matching columns

    Thanks GC Excel for the solution.

    I want to modify my requirement lit bit.Possible that Macro can Delete the duplicate records from Sheet1,rest of the requirement remains the same.

    Thanks once again

  5. #5
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Matching columns

    Hi,
    See if this code works in the attached file.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    10-21-2010
    Location
    LONDON
    MS-Off Ver
    2007
    Posts
    108

    Re: Matching columns

    Thanks GC for your reply.

    I checked the Macro is not deleting the duplicate records from Sheet1.Although it is displaying the duplicate rows in sheet "Result".

    When I am clicking the blue button in sheet1.it is showing the error "Cannot run the macro "Sample with code 2.xlsm!test'.The macro may not be avialable in this workbook or all macros may be diabled".So I had to run this macro from VB module.

    Thanks

  7. #7
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Matching columns

    Hi,
    How do you define duplicate records ?
    Does all the columns must be the same or only specific columns ?
    In the current file you have all rows are different. (no duplicates)

  8. #8
    Forum Contributor
    Join Date
    10-21-2010
    Location
    LONDON
    MS-Off Ver
    2007
    Posts
    108

    Re: Matching columns

    As I said the above code which you provided me perfect.I just want to add another feature that is Deletion of duplicate records.

    The data which you have provided in "REsult" worksheet should get deleted from SHEET1.

    Thanks

  9. #9
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,414

    Re: Matching columns

    Ok... got it.
    Try the attached file.
    Attached Files Attached Files

+ 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: 2
    Last Post: 04-18-2013, 05:56 PM
  2. Align 3 columns with 2 columns of matching data
    By bearnbillie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-04-2012, 08:33 AM
  3. Replies: 3
    Last Post: 06-09-2011, 05:58 AM
  4. sort columns based on matching 1st & 2nd columns
    By repke in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 02-13-2011, 01:37 PM
  5. compare columns and count number of matching columns
    By san000 in forum Excel General
    Replies: 1
    Last Post: 07-15-2009, 10:31 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