+ Reply to Thread
Results 1 to 8 of 8

Compare ranging part of a string in two columns

  1. #1
    Registered User
    Join Date
    11-03-2011
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    4

    Compare ranging part of a string in two columns

    Hi I'm new to all of this but I'm trying to compare the last part of two strings. In column A and B there are two lists of data all build-up in the same manner 'ID-code [department] description".

    example
    In column A : "TEST-79 [BA] This is a use case of a function"
    In column B: "TEST-1889 [TEST] This is a use case of a function"

    I want the example data to be matched on the last part of the string (This is a use case of a function) but the problem is the last part can have a length of 5 to 50 characters. The last character I want to be ignored is always "]".

    I already have some code but I can imagine it cant be used for the function I want, also the selection method of column A and B can be different but its ok for me as it is.

    Please Login or Register  to view this content.
    Last edited by Jeroen79; 11-04-2011 at 09:54 AM.

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

    Re: Compare ranging part of a string in two columns

    Please Login or Register  to view this content.



  3. #3
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Compare ranging part of a string in two columns

    When you say you want the columns to be matched what are you actually trying to do? Do you want to confirm that the value in column A also appears in column B? Do you want to perform some action on the cells?

  4. #4
    Registered User
    Join Date
    11-03-2011
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Compare ranging part of a string in two columns

    snd when I try to run your code I get an error on this line: cl.offset(,2)=split(cl,"]")(1)=split(cl.offset(,1),"]")(1) can it be because Im using a dutch excel version (company computer).

    Andrew-R, I want the description part of the cell to be matched, column A and B are not sorted and contain information that will not be matched. Then the matched cells have to be copied to column C and D so they are both at the same row. I would be wonderfull when the not matched items from column A and B are highlighted.

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

    Re: Compare ranging part of a string in two columns

    It means that your data differ form your description.
    You'd best post a sample workbook.

    and use:

    Please Login or Register  to view this content.
    PS. I also use a Dutch system; VBA is only familiar with the American language.
    Last edited by snb; 11-04-2011 at 07:34 AM.

  6. #6
    Registered User
    Join Date
    11-03-2011
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Compare ranging part of a string in two columns

    Here is a sample workbook.
    Attached Files Attached Files

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

    Re: Compare ranging part of a string in two columns

    Workbook in return
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-03-2011
    Location
    Amsterdam, The Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Compare ranging part of a string in two columns

    Its working the way I want when both values are on the same row but when they are not on the same row this won't find the match. But I think I can incorperate this in another script I found.

    The matching of the cells works so thats great, thanks.

+ 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