+ Reply to Thread
Results 1 to 5 of 5

Comparing each item in column? to a list in column?, color both cells if same

  1. #1
    Registered User
    Join Date
    09-25-2014
    Location
    U.S.A
    MS-Off Ver
    2010
    Posts
    20

    Cool Comparing each item in column? to a list in column?, color both cells if same

    Good day everyone. I am attempting to create a macro or code that will compare two lists of data to check if the item in list A is mached in list B. Each cell in the list A will be comparred to each cell in list B. If a match is found, both matching cells are colored or moved to another column or sheet to indicate and verify a match. I have attached a file as an example of what I am looking to do. Thank you all in advance.

    Sample File.xls

  2. #2
    Registered User
    Join Date
    08-04-2009
    Location
    Golborne England
    MS-Off Ver
    2013
    Posts
    85

    Re: Comparing each item in column? to a list in column?, color both cells if same

    Here is a quick Macro that I think does what you want.

    It compares the two columns and highlights the matches in green and also create two new columns with the matched data paired side by side.


    JimBobBowie

    Sample1.xls

  3. #3
    Registered User
    Join Date
    09-25-2014
    Location
    U.S.A
    MS-Off Ver
    2010
    Posts
    20

    Re: Comparing each item in column? to a list in column?, color both cells if same

    Good afternoon JimBobBowie. Thank you very much for taking the time to look into this for me. It works great. I have found that it is skiping over cells that should be green and I believe that it is because some of the cells in the second column have an extra space at the end of the cell so it is not matching up with a cell in the left column that is the same but does not have that empty space. Do you have an idea how to account for either column having that space and just if the text is an match? Example below. Thank you again.
    Attached Files Attached Files
    Last edited by JamesJohnson31; 10-14-2014 at 12:37 PM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Comparing each item in column? to a list in column?, color both cells if same

    Hi, JamesJohnson31,

    any particular reason why you attach a word document in a question posted in an ExcelForum?

    Use Trim to skip all leading and trailing blanks in the cells
    Please Login or Register  to view this content.
    And I wonder why there´s a lot of Select which isnt necessary at all ´(except for the macro recorder) as well as I would use Find, Worksheet.CountIf or Application.Match instead of a loop.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Registered User
    Join Date
    09-25-2014
    Location
    U.S.A
    MS-Off Ver
    2010
    Posts
    20

    Re: Comparing each item in column? to a list in column?, color both cells if same

    I attached the word doc to show the output of the script. Apologies if that was bad form. Thank you for your input. I will play with it some more. Thanks again.
    Last edited by JamesJohnson31; 10-14-2014 at 02:16 PM.

+ 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. Comparing cells in a column and adding result of comparison in cells of adjacent column
    By Lionel welshboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 05:37 AM
  2. VBA code for comparing a worksheet with a column and show the result with a color
    By Derken73 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2012, 08:46 PM
  3. Replies: 5
    Last Post: 05-17-2012, 10:51 PM
  4. Replies: 0
    Last Post: 05-16-2012, 03:03 AM
  5. Replies: 5
    Last Post: 03-26-2012, 11:50 PM

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