+ Reply to Thread
Results 1 to 11 of 11

Compare two strings and output the differences

  1. #1
    Registered User
    Join Date
    07-07-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    9

    Compare two strings and output the differences

    Dear Jindon:

    As per your instructions, I am creating a new thread for this topic. For all readers, the original thread is here: http://www.excelforum.com/excel-prog...05#post3313305

    I am in receipt of your updated VBA function but I am having two problems with it:
    1. Unable to access the VBA code for copying into my live workbook
    2. The output is odd when there are punctuation characters in the strings

    Would appreciate your help in resolving these two issues. Please advise. Samples attached from previous thread for convenience.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Compare two strings and output the differences

    Here's the file.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-07-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Compare two strings and output the differences

    just having one more error if you can please advise...
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Compare two strings and output the differences

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-07-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Compare two strings and output the differences

    Thanks! This is working great. Last question/tweak is: there are only some errors/artifacts on lines that have other punctuation marks contained in the description. If you can provide me a bit of guidance, I can tweak the code myself, or if you want to add handling for these situations, that would be the final great help in this project! The weird formula outputs occur when one of the following punctuation marks occur in the "original" string:
    • #
    • (
    • "
    • &

    As you will see in the sheet attached for your convenience. Putting in handling for these items would also help me compare your previous code to your update and I can learn by seeing what changes you did, too! Thanks in advance!
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Compare two strings and output the differences

    I hate this....

    I don't like the way you ask the question.

    Feel like you are testing me.

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Compare two strings and output the differences

    maybe this option
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-07-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Compare two strings and output the differences

    Thanks nilem, that worked PERFECTLY!!!!

    And jindon, don't get the wrong impression, was just trying to get the thing to work and learn something from your skills along the way. Thanks to both of you!

    As a side note, if you guys have any tutorials/references that you can point me to that helped you learn, that would be great so one day maybe I can be helping folks just like you do!

  9. #9
    Registered User
    Join Date
    07-07-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Compare two strings and output the differences

    Hey Nilem - I've found that this script works great, but for one issue: when the strings appear in a different order, it flags them as "different." Do you know any way to fix this so it is comparing for those strings anywhere in the main string except for in the order it expects for them to be in?

    Example:

    Bic Pens 1CT Blue
    Bic Pens Blue 1CT

    Still returns 1CT as the "string difference."

    Thanks in advance for your advice.

    -aliastx

  10. #10
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Compare two strings and output the differences

    Hi aliastx,
    see attachment
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-07-2013
    Location
    Dallas
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Compare two strings and output the differences

    Hi Nilem, sorry it's taken so long to get back to you. Your code helped a TON. There were still a few weird things going on with slashes and dashes and stuff in the description but THANK YOU FOR YOUR HELP! I really appreciate it, and I'm 100% sure this is applicable across so many different projects! I'm going to try and compile some examples of the dash and slash errors so that I can learn from you how to deal with them (will update here tonight or tomorrow), but I just wanted to say THANKS and you're AWESOME!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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