+ Reply to Thread
Results 1 to 5 of 5

Writing matched results of column "A" and "B" in "C" column

  1. #1
    Registered User
    Join Date
    05-05-2023
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Microsoft Office Professional Plus 2016 en-US
    Posts
    3

    Writing matched results of column "A" and "B" in "C" column

    Hi there,
    Hope you're doing well.

    My question is about to writing matched results of column "A" and "B" in "C" column. But in each rows separately.
    For example:
    A B C
    ALFAROMEO user,default,alfa.romeo alfa.romeo
    So I've names in A column but only one name in one cell. But in the column B have more than one name in each cell which comma-separated.
    And some names in A is not the same exactly.
    Some contains "1" or does not contain full name. Or in B column last names comes first. For example: beta.alfa instead of alfa.beta
    Here is what I mean;

    11.PNG

    I want to output this;

    22.PNG

    Thank in advance.

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,504

    Re: Writing matched results of column "A" and "B" in "C" column

    Could you attach sample sheet?
    Are you OK with UDF?
    for ex:
    in C1:
    =matchText(A1:B1)
    Quang PT

  3. #3
    Registered User
    Join Date
    05-05-2023
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Microsoft Office Professional Plus 2016 en-US
    Posts
    3

    Re: Writing matched results of column "A" and "B" in "C" column

    Quote Originally Posted by bebo021999 View Post
    Could you attach sample sheet?
    Are you OK with UDF?
    for ex:
    in C1:
    =matchText(A1:B1)

    Sure here it is, but I need macro.
    Thanks.

    sample.xlsx

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,504

    Re: Writing matched results of column "A" and "B" in "C" column

    UDF (User-define-formula) in C1 then drag down
    =matchText(RangeOfTwoCells)
    =matchText(A1:B1)

    How?
    Alt-F11 to open VBA window, Insert / module, paste below code into:
    PHP Code: 
    Option Explicit
    Function matchText(ByVal rng As Range)
    Dim Text1 As StringText2 As Stringsasbs
    Text1 
    LCase(rng.Cells(11).Value)
    Text2 LCase(rng.Cells(12).Value)
    For 
    Each sa In Split(Text2",")
        If 
    sa Text1 Then
            matchText 
    sa
            
    Exit Function
        ElseIf 
    InStr(1sa"."Then
            sb 
    Split(sa".")
            
    sb(0) & sb(1)
            If 
    InStr(1Text1s) Or InStr(1sText1Then
                matchText 
    sa
                
    Exit Function
            
    End If
            
    sb(1) & sb(0)
            If 
    InStr(1Text1s) Or InStr(1sText1Then
                matchText 
    sa
                
    Exit Function
            
    End If
        
    End If
    Next
    matchText 
    ""
    End Function 
    Save as file as .xlsm
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-05-2023
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Microsoft Office Professional Plus 2016 en-US
    Posts
    3

    Re: Writing matched results of column "A" and "B" in "C" column

    Quote Originally Posted by bebo021999 View Post
    UDF (User-define-formula) in C1 then drag down
    =matchText(RangeOfTwoCells)
    =matchText(A1:B1)

    How?
    Alt-F11 to open VBA window, Insert / module, paste below code into:
    PHP Code: 
    Option Explicit
    Function matchText(ByVal rng As Range)
    Dim Text1 As StringText2 As Stringsasbs
    Text1 
    LCase(rng.Cells(11).Value)
    Text2 LCase(rng.Cells(12).Value)
    For 
    Each sa In Split(Text2",")
        If 
    sa Text1 Then
            matchText 
    sa
            
    Exit Function
        ElseIf 
    InStr(1sa"."Then
            sb 
    Split(sa".")
            
    sb(0) & sb(1)
            If 
    InStr(1Text1s) Or InStr(1sText1Then
                matchText 
    sa
                
    Exit Function
            
    End If
            
    sb(1) & sb(0)
            If 
    InStr(1Text1s) Or InStr(1sText1Then
                matchText 
    sa
                
    Exit Function
            
    End If
        
    End If
    Next
    matchText 
    ""
    End Function 
    Save as file as .xlsm
    Great! Thank you so much, it works like a charm!
    I appreciate you taking the time.

+ 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: 5
    Last Post: 02-05-2019, 12:03 AM
  2. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  3. Replies: 1
    Last Post: 08-20-2016, 01:59 AM
  4. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  5. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  6. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  7. Replies: 2
    Last Post: 06-06-2013, 12:45 PM

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