+ Reply to Thread
Results 1 to 4 of 4

String Comparator with Percentage?

  1. #1
    Forum Contributor
    Join Date
    04-13-2017
    Location
    Buchares
    MS-Off Ver
    2016
    Posts
    117

    Question String Comparator with Percentage?

    Hey guys.

    I'm having quite a mess with lots of data and some of them are almost the same things just in another word assambley

    I was wondering if a function for an idea like :

    Col A string : "Hey, here is alex"
    Col B string : " Hey, alex is here "

    2 Percentages to be displayed? Like all the words are there , meaning 100% word match, but the position of them is strange so would be like 80% ?
    like =testequal(ColA string, ColB string) and the results would be (W : 100% , S :80%) (w from words, S from phrase?)

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: String Comparator with Percentage?

    The most common string comparators are just character-by-character comparisons (see Levenshtein distance). I think the reason you are not getting responses is that you want artificial intelligence/language processing. That's a tall order for Excel/VBA.

    It would certainly be possible to compare two strings to see what percentage of the words match, but as the strings get longer such a number becomes more meaningless. For example,

    I had a cup of coffee instead of a full breakfast.
    I had a full breakfast with a cup of coffee instead of juice.

    High score on word matches but they have totally different meanings.

    The best approach depends on what is the nature of the phrases you are going to compare.

    Also, I am not seeing how you are calculating 80%.

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: String Comparator with Percentage?

    Quote Originally Posted by alexgoaga View Post
    ..."Hey, here is alex" ... / ... " Hey, alex is here "
    ... 100% word match, but the position of them is strange so would be like 80% ?
    ... the results would be (W : 100% , S :80%) (w from words, S from phrase?)
    ... "S :80%" ... "S from phrase" ...
    Not a phrase, but the position of words in a sentence/phrase, as yourself you wrote above ... and is not 80%, but 50% to 50% => 50% of words have the same position and 50% different: "Hey xxx is xxx".

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: String Comparator with Percentage?

    I was about to reply 'Yes, it is possible. I have converted fuzzy logic formulas into VBA functions and used these to get a % match result" until I realised you want the word position not character match closeness.

    Here's a thought - Try using Split on both strings to break them into arrays of words then loop the arrays to compare the positions of each word.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

+ 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. Formula to Extract Percentage Value from Text String
    By Sparky666 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-03-2019, 02:08 AM
  2. Payment Term Percentage from string of text
    By jhm5139 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-27-2016, 11:49 AM
  3. Replies: 1
    Last Post: 09-20-2016, 07:33 PM
  4. [SOLVED] Getting the percentage from a string
    By djfatboyfats in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-10-2016, 06:09 AM
  5. Dynamic Comparator?
    By CameronR in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-18-2013, 10:01 AM
  6. PDF Comparator
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-25-2012, 01:45 PM
  7. Multiple Column Lookup Needs to combine formatting for Percentage and Text String.
    By Cardinalbags in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-22-2012, 09:47 AM

Tags for this Thread

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