+ Reply to Thread
Results 1 to 10 of 10

Highlight matching parts of a string

  1. #1
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Smile Highlight matching parts of a string

    I have two cells containing comma seperate strings of text. I would like to compare them and highlight any matches in the string.

    Eg
    A1= a, b, c, d, e
    A2= a, f, e, g, h.

    The list are in no particular order or length and can contain any number of values. all seperated by comma space.
    Last edited by ianh; 11-22-2010 at 11:21 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Highlight matching parts of a string

    You cannot conditionally format a part of a cell entry.

    If you separate each entry into individual cells, then you can highlight cells.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Highlight matching parts of a string

    You can format parts of a cells text, I have been using the following code to highlight parts that dont match
    Please Login or Register  to view this content.
    Run by the following macro

    Please Login or Register  to view this content.
    I need to be able to carry out the inverse of this and highlight the matches but cant get the code to work that way.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Highlight matching parts of a string

    I guess I assumed you were looking for conditional formatting via native Excel functions...

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Highlight matching parts of a string

    Simple version:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Highlight matching parts of a string

    Please Login or Register  to view this content.
    Last edited by snb; 11-22-2010 at 09:49 AM.



  7. #7
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Highlight matching parts of a string

    That great, thanks for your help

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Highlight matching parts of a string

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  9. #9
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Highlight matching parts of a string

    I'm trying to scale this up to suit the work book but for some reason it doesn't always highlight all of the matching values. I'm not sure why not.

  10. #10
    Forum Contributor ianh's Avatar
    Join Date
    11-19-2010
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    114

    Re: Highlight matching parts of a string

    It's now working with the live data, not sure what happened in between, many thanks agin for both methods

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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