+ Reply to Thread
Results 1 to 10 of 10

Is it possible to compare 2 cells in each row and highligt characters that are different?

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    Armpit, FL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Is it possible to compare 2 cells in each row and highligt characters that are different?

    I would like to do this with conditional formatting but don't know how. If not CF, perhaps VBA? The max len of both cells is 20 characters and I would want it do repeat for all rows in the worksheet.

    Please see attached sample of what I would like to end up with. Thanks in advance for any suggestions.

    1sample.JPG

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,080

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    I think VBA is your only option.
    Wait till a VBA expert comes along...
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    04-26-2013
    Location
    Armpit, FL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    Thanks Special K. I was thinking that was probably the case. I hope there are some VBA experts around. I know there's probably a way to build a loop that goes through each character and sets format but that's a tad above my skill set without doing much trial and error.

  4. #4
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,028

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    Quote Originally Posted by unhappyCamper View Post
    Thanks Special K. I was thinking that was probably the case. I hope there are some VBA experts around. I know there's probably a way to build a loop that goes through each character and sets format but that's a tad above my skill set without doing much trial and error.
    The difference between the two column, is it only the last character?
    If that is not the case, can you upload more samples?

  5. #5
    Registered User
    Join Date
    04-26-2013
    Location
    Armpit, FL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    I want to compare character by character for the two strings. there could be multiple differences in any location.

    Capture.JPG

  6. #6
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,028

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    Try this:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-26-2013
    Location
    Armpit, FL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    If I understand the code, this would only work if col 1 and 2 are the only columns. Correct? What if other columns existed and I only want to compare col A and say col G? Could I just change Mid(Cells(i,2) to Mid(Cells(i,7)?

  8. #8
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,028

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    Quote Originally Posted by unhappyCamper View Post
    If I understand the code, this would only work if col 1 and 2 are the only columns. Correct? What if other columns existed and I only want to compare col A and say col G? Could I just change Mid(Cells(i,2) to Mid(Cells(i,7)?
    Yes, you're right, just change Mid(Cells(i,2) to Mid(Cells(i,7)

  9. #9
    Registered User
    Join Date
    04-26-2013
    Location
    Armpit, FL
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    Thanks for your help Akuini. Works like a charm!!

  10. #10
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,028

    Re: Is it possible to compare 2 cells in each row and highligt characters that are differe

    Glad to help & thanks for replying.

+ 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] How do I compare just the first 10 characters in two sheets
    By raw_geek in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-10-2014, 01:27 PM
  2. Replies: 11
    Last Post: 01-23-2013, 02:04 PM
  3. Compare characters of two cells and return the result
    By shahid6634 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-27-2012, 08:43 AM
  4. Compare characters in two columns
    By enhydra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2011, 11:22 AM
  5. Replies: 1
    Last Post: 10-19-2011, 07:48 AM
  6. Compare first 4 characters question
    By goodiein2808 in forum Excel General
    Replies: 6
    Last Post: 09-07-2011, 12:07 AM
  7. Replies: 4
    Last Post: 02-04-2007, 11:08 AM

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