+ Reply to Thread
Results 1 to 5 of 5

Compare large text strings, highlight differences

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Compare large text strings, highlight differences

    Hi all, got a bit of a doozy here, and am really hopeful that one of you already has the DNA for this kind of thing worked out and wouldn't mind sharing...

    Unfortunately, my requirements are a little vague, but I think if I can make some progress, I can work on my own to refine the solution as needed. So, here goes.

    I'm trying to find a way to compare two large alphanumeric text strings and highlight the differences. The rabbit hole is, of course, in defining "different" and honestly I'm not quite sure yet. But like I said, I'll take whatever I can and work with it.

    In a nutshell, I have a userform with 2 text entry fields... similar content will go in each one (the largest same I've seen so far is just shy of 5,000 words), but one of them is considered a "golden copy" - that is, the one that is more correct. The content is cleaned (capitalized, extraneous spaces removed, line breaks normalized) and saved in two strings, Goldenstring and Otherstring. What I'd like to do is find the highlight the differences.

    I hope that makes sense - any help is greatly appreciated!

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Compare large text strings, highlight differences

    5000 words is like 20 pages.
    Depending on how you want to highlight differences in that quantity of text, have you considered using Word's document comparison feature?
    The following code saves the textboxes into two Word documents and creates a third comparison document. You can then open the comparison document and use the track changes feature to see the differences.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Compare large text strings, highlight differences

    Thanks ByteMarks - really appreciate that. The end user was shown the word comparison feature but didn't care for it (primarily because he wants to use his own excel skills to compile stats on the errors between the 1,000+ documents this has to address).

    I will play around with what you generously provided above though, and see what I can do to cross the bridge between the apps. THANK YOU AGAIN!

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Compare large text strings, highlight differences

    If it's just stats then perhaps some percentage similarity algorithm would be more appropriate?

  5. #5
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Compare large text strings, highlight differences

    ByteMarks - sorry for the delay, didn't have internet access most of the weekend (and I highly recommend that from time to time!)

    I did try going down that road, but I couldn't get the results right enough for my liking. I know nothing will be perfect (because I have to try to gauge intent at times), but the similarity % just wasn't working for me.

    Thanks again for your time - I may see if I can pass this whole project over to our data science team, who I think have been working on something similar.

    Enjoy your day!

+ 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: 11-27-2016, 05:56 PM
  2. Compare character strings in 2 cells and return only the differences
    By Barcenal28 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-09-2015, 05:12 PM
  3. Replies: 1
    Last Post: 03-06-2015, 01:07 PM
  4. Compare two strings and output the differences
    By aliastx in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-14-2013, 10:49 PM
  5. Compare Differences between 2 strings
    By wadafruck in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-11-2012, 07:09 PM
  6. Replies: 3
    Last Post: 06-12-2012, 10:11 PM
  7. [SOLVED] Compare cells/columns and highlight matching text strings
    By luxbelle in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-25-2005, 06:06 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