+ Reply to Thread
Results 1 to 5 of 5

Compare two columns and highlight difference

  1. #1
    Registered User
    Join Date
    11-07-2019
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Wink Compare two columns and highlight difference

    Hi,

    I already got a version of my own that works for now, but the larger the files get the harder it is to get the compare because off the amount of resourses the process uses.

    See my code below would be nice to smoothen this code out and get it faster to work.

    Function is basicly compare row 2 with row 5 and when there is a difference highlight cell.


    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Compare two columns and highlight difference

    It looks like you are comparing column B and column E, not row 2 and row 5.

    "Function is basicly compare row 2 with row 5 and when there is a difference highlight cell." That description does not seem to match what this code does. The code looks at each value in column B to see if a value in column E can be found anywhere in the column B value; it will consider a partial match to be a match (that is, if E has "ABC" and B has "XABCX" it will be considered a match). Do you really want partial matches? For any non-matches it highlights column B in one color, and if it finds a match it highlights column B in a different color and then stops looking for matches for that row of column B. The code inefficiently repeats the formatting for non-matches until it finds a match.

    Then it repeats this method looking for matches from column E.

    Can you provide sample data for this so we can run the code? The paper clip icon does not work for attachments. To attach a file, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.

    Is there a reason you want to use VBA to permanently format these cells rather than using Conditional Formatting to do the same thing? This code is a little more efficient but I think CF would be much faster.

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-07-2019
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    8

    Re: Compare two columns and highlight difference

    Hi,

    Yes your right Colums not rows my bad.

    I dont have a specific reason to do it this way. Only thing I need is to be able to see the difference between the two columns.

    What I need is to check the differences between the two even just a letter difference thought highlighting is probably the best option to keep it visible.

    Attached is a large amount of items which I would like to compare(33k). Got 1 file with 42k items but im sure when this one works it will work on the other one also.

    Thanks in advance,

    Kind regards
    Ryan
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hi,

    according to your attachment no need a code as I just get an instant result with an EZ conditional formatting …

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Compare two columns and highlight difference

    Here is your attachment with conditional formatting. For column B the rule is

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A similar rule is used for column E.

    This requires an exact match, which is probably what you actually intended. You haven't answered my question about partial matches.

    This is lightning fast compared to a macro.
    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. VBA Compare rows and highlight the difference
    By Dvanacharla in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-03-2019, 05:40 PM
  2. [SOLVED] Compare Column and highlight difference
    By Barieq in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2017, 07:35 AM
  3. [SOLVED] Compare 2 columns with 1 column and highlight difference
    By pradeepdeepu_001 in forum Excel General
    Replies: 3
    Last Post: 12-15-2016, 02:11 AM
  4. Compare Two Columns and Highlight the Difference
    By VickyVykciV in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-25-2014, 01:21 AM
  5. Replies: 2
    Last Post: 04-12-2013, 06:20 PM
  6. Replies: 5
    Last Post: 01-06-2012, 04:15 AM
  7. Compare two worksheets and highlight the one sheet’s difference from the other one
    By minrufeng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2006, 06:28 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