+ Reply to Thread
Results 1 to 4 of 4

URGENT find common string values in 2 colums

  1. #1
    Registered User
    Join Date
    12-11-2012
    Location
    United Arab Emirates
    MS-Off Ver
    Excel 2010
    Posts
    2

    URGENT find common string values in 2 colums

    Dear All,

    Please help in the following...

    i have 2 columns each on have string values separated by commas
    example:

    columns 1

    O9,L2,A2,7E,IT2
    A2,C6,HY,IK,O9,CHE,MCP
    IK,3D,HY,A8,P0,IY
    7E,HY,O9,IT2,L2


    columns 2
    P0,L2,IT2,7E,3D
    A2,HY,L2,IK,O9,CHE,MCP
    IK,IT2,HY,A8,7E,O9
    O9,C6,IY,A2,HY

    I need to create a button to run a macro to create the 3rd column of Common string. The cells under the Common String column must contain the common codes from the first 2 columns and must be separated by comma in alphabetical order.

    Please anyone can you help.

    Regards

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: URGENT find common string values in 2 colums

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook. Make sure the workbook demonstrates your sample data AND your desired results.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-11-2012
    Location
    United Arab Emirates
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: URGENT find common string values in 2 colums

    sample.xlsx

    please find attached sample,

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: URGENT find common string values in 2 colums

    Here are two functions to accomplish this. One I wrote called CompareLists() and it is a UDF. Here's the code, it goes in a standard code module, not a sheet module:
    Please Login or Register  to view this content.

    Once installed you use it in a cell like any other formula, in C2:

    =COMPARELISTS(A2, B2, ",", TRUE)


    RANGE1 - the first delimited list in a cell. Only the first cell will be used if this is a multicell range
    RANGE2 - the second delimited list in another cell. Only the first cell will be used if this is a multicell range
    DELIMITER - an optional string that indicates the delimiter in each comparison cell, the default is comma
    TRUE/FALSE - optional, if TRUE is a list of common items, if FALSE or omitted is a list of non-common items



    The second function is a BubbleSort function using a popular technique that is used to "sort an array in vba", it is putting the results into alphabetical order as you requested.
    Last edited by JBeaucaire; 12-13-2012 at 11:25 AM.

+ 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