+ Reply to Thread
Results 1 to 16 of 16

Compare two columns - words by word - display number of word match

  1. #1
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Question Compare two columns - words by word - display number of word match

    Hi Gents,

    A big challenge!

    I am searching for a code for comparing two columns of data and get the word match.

    Following is the example.

    * Col A is the list where we will search
    * Col B has the search string
    * We need to search the words in cel B2 in range A2:A8 list
    * we need to show the word match result in C2,d2,d3 (full/partial/none)
    * we need to color each type of match in different color. (optional)


    Capture.JPG
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439
    Please check by yourself because i am coding on my phone and didn't check yet.
    Use array formula on C2:E2
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by AliGW; 10-24-2018 at 03:32 AM. Reason: Unnecessary quotation removed.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Compare two columns - words by word - display number of word match

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 10-17-2018 at 08:19 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,001

    Re: Compare two columns - words by word - display number of word match

    If there is 'kiwi apple mango' in column A, is it considered as partial match?

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

    Re: Compare two columns - words by word - display number of word match

    UDFs
    1) Formula in
    C2: =PartialMatch(B2,$A$2:$A$8)
    D2: =FullMatch(B2,A2:A8)
    E2: =NoMatch(B2,A2:A8)

    2) To a Standard code module
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Good Question. Yes. it is please.
    if Kiwi apple mango then partial match
    only Mango Kiwi Apple - is a full match

    if not possible, its fine. i can add a formula somehow to the next column to fix it.

    thank you again.

  7. #7
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Quote Originally Posted by huuthang_bd View Post
    Please check by yourself because i am coding on my phone and didn't check yet.
    Hi,

    I try this code and it give Value# error.

    Thank you.
    Last edited by AliGW; 10-24-2018 at 03:33 AM. Reason: Quotation shortened.

  8. #8
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Quote Originally Posted by jindon View Post
    UDFs
    Hi,

    This works fine and its very fast.

    Thank you
    Last edited by AliGW; 10-24-2018 at 03:34 AM. Reason: Quotation shortened.

  9. #9
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Quote Originally Posted by AlphaFrog View Post
    Please Login or Register  to view this content.
    Hi

    This works fine, thank you for the colors.

    sorry i did not describe it in the first place.

    i need this down like a formula,

    Capture2.JPG

    Thank you so much anyways for the code.
    Last edited by AliGW; 10-24-2018 at 03:35 AM. Reason: Quotation shortened.

  10. #10
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Gents,

    hope i am not breaking any forum rules. but this another question in regard to the above solution.

    Now we are very happy that all your codes giving the number of matches (full/partial/none). We went crazy seeing the partial match numbers. (its so high)

    Thanks to "AlphaFrog", we got another requirement,

    Is it possible (of course it is ), we can display the list of partial and full match below like the image below,

    Capture3.JPG

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Compare two columns - words by word - display number of word match

    Quote Originally Posted by nasrulla View Post
    Hi

    This works fine, thank you for the colors.
    If you search multiple terms in rows in column B, then coloring the values in column A is sort of pointless. A reference in column A may be no match for one search word in column b and an exact match for another. So what color should it be?
    Last edited by AliGW; 10-24-2018 at 03:35 AM. Reason: Quotation shortened.

  12. #12
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Guru,

    I agree with you. Your code made us think again to approach this in a different view.
    So, we are NOT going to copy B3, b4 and so on like formula.
    We will keep only one search text, but we need your help coding to list the partial match below. as per my last post above. (cell b 13 and below)

    Thank you again.
    Last edited by AliGW; 10-24-2018 at 03:35 AM. Reason: Unnecessary quotation removed.

  13. #13
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Gentlemen,

    Thank you again for your help. really appreciate your time and sharing knowledge helping people.

    Kindly help to finalize this code

    We need a one final push..

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Compare two columns - words by word - display number of word match

    All participants - please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  15. #15
    Registered User
    Join Date
    03-25-2017
    Location
    Dubai
    MS-Off Ver
    365 ProPlus
    Posts
    42

    Re: Compare two columns - words by word - display number of word match

    Thank you and will follow the same next time.

    "Enthusiastic self-taught user of MS Excel who's always learning!" the sentence fit for me as well

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Compare two columns - words by word - display number of word match

    Thank you!

+ 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: 4
    Last Post: 08-23-2017, 08:11 AM
  2. Find / Extract Word & Words after a Specific Word
    By roseuz in forum Excel General
    Replies: 8
    Last Post: 07-05-2017, 01:07 PM
  3. Replies: 1
    Last Post: 02-21-2016, 02:39 AM
  4. Replies: 18
    Last Post: 06-30-2015, 08:24 PM
  5. Replies: 4
    Last Post: 06-28-2015, 10:57 AM
  6. Words to Equal Number but Show Word
    By jdsimons2 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-11-2013, 01:28 AM
  7. [SOLVED] search for a specific word and copy the word and the preceeding words until a comma
    By DHANANJAY in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-31-2005, 09:10 AM

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