Link to home
Start Free TrialLog in
Avatar of montrof
montrofFlag for United States of America

asked on

VBA Match String Percentage

Hi experts,

Does anyone have a vba function that can tell you the percentage match of two strings.  So that I could compare two cells and and get a percentage that they match.

Thanks,
Montrof
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Montrof ,

Can you give more details about what you are trying to do.

Also an example workbook always help..

Saurabh...
Avatar of montrof

ASKER

I am trying to compare values like such

Cell A1- Cat compare to Cell B1 Cap so they match at 66% since 2 of the 3 characters match.  

Montrof
Help me Understand which is your base i.e. A1 or B1 hat i mean by that is let's say

If A1-->Cat
B2-->Capsule

How much % whether its 66% if cat is base or 28% if capsule is base...

Saurabh...
ASKER CERTIFIED SOLUTION
Avatar of Professor J
Professor J

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Look at the Levenshtein algorithm:
http://en.wikipedia.org/wiki/Levenshtein_distance

There are several other algorithms listed at the bottom of that wiki article that might be worth consideration.  These algorithms have been around long enough that there are coding examples in most languages, including VBA.
Avatar of montrof

ASKER

Perfect Thank you