+ Reply to Thread
Results 1 to 10 of 10

Compare cell text to set list and show text differences

  1. #1
    Registered User
    Join Date
    03-13-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    59

    Compare cell text to set list and show text differences

    Hello. I need help solving the following issue. I am trying to write a function that will compare the text of cell "A2" to the text of cell "B2" and display cell "A2"'s text characters that didnt match from cell "B2" in column C. Can anyone help me out with writing this formula?

    EX:

    A2 = "Apple123"
    B2 = "AppleS78"

    Result = "S78"


    Thank you in advance.
    Last edited by NSTurk725; 12-06-2009 at 08:18 PM.

  2. #2
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Akron, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Compare cell text to set list and show text differences

    Wouldn't your result be 123; those are the characters that are in A2 and not in B2.

    Or do you just want to remove from B2 the characters that are the same in A2?

    Can it be vba code? You could write something to pull one character at a time from A2, compare it against B2 and save it to another variable if it doesn't match.
    Last edited by jrdnoland; 12-05-2009 at 07:43 PM.

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare cell text to set list and show text differences

    hi jrdnoland
    Are there any patterns in the strings
    A2 = "Apple123"
    B2 = "AppleS78"
    Result = "S78"
    what if
    A2 = "Apple127"
    B2 = "AppleS78"
    would the result be "S8" ?
    or
    A2 = "Appl127"
    B2 = "AppleS78
    would the result be "eS8" ?
    playing around with
    Please Login or Register  to view this content.
    when I realised that the next step comparing the two arrays with a Dictionary would remove all duplicates
    can you please illuminate/clarify any patterns/requirements
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare cell text to set list and show text differences

    try this udf..
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-02-2009
    Location
    Akron, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    208

    Re: Compare cell text to set list and show text differences

    Quote Originally Posted by pike View Post
    hi jrdnoland
    Are there any patterns in the strings
    A2 = "Apple123"
    B2 = "AppleS78"
    Result = "S78"
    what if
    A2 = "Apple127"
    B2 = "AppleS78"
    would the result be "S8" ?
    or
    A2 = "Appl127"
    B2 = "AppleS78
    would the result be "eS8" ?
    playing around with
    Please Login or Register  to view this content.
    when I realised that the next step comparing the two arrays with a Dictionary would remove all duplicates
    can you please illuminate/clarify any patterns/requirements


    Hi Pike - I had similar questions, like your function. Will have to see what the original poster wants.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare cell text to set list and show text differences

    hi jrdnoland
    this is the other logical option
    Please Login or Register  to view this content.
    up early as the fish are calling ciao
    Last edited by pike; 12-06-2009 at 05:53 PM.

  7. #7
    Registered User
    Join Date
    03-13-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: Compare cell text to set list and show text differences

    Hey guys, sorry about that. First off, I appreciate your help. Secondly, you were right jr...the result should have been "123". My fault. Here is how the data will look:

    Customer Part-Customer Part Number

    A2 = "Alternator-DD123"
    B2 = "Alternator-SF164"

    C2 = DD123

    Basically, I am trying to pinpoint the changes from month to month. Did the change result from a customer part or a customer part number.

    I hope this information helps. Sorry again about the unclear and shitty first post.
    Last edited by NSTurk725; 12-06-2009 at 05:37 PM. Reason: Didn't post enough detail in original post

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare cell text to set list and show text differences

    Hi NSTurk725
    this function will do it
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-13-2009
    Location
    Malta
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: Compare cell text to set list and show text differences

    Thank you Pike! I appreciate your help greatly.

  10. #10
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Compare cell text to set list and show text differences

    No worries is was fun

+ 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