Is there a method or formula of working out how similar the data is in two cells?
i.e. Cell A1 has "Mr John Moore" and Cell B1 has "John Moore" What is the percentage of similarity between these 2 cells?
Thank you
Is there a method or formula of working out how similar the data is in two cells?
i.e. Cell A1 has "Mr John Moore" and Cell B1 has "John Moore" What is the percentage of similarity between these 2 cells?
Thank you
Last edited by guerillaexcel; 06-16-2010 at 10:55 AM.
Below is a UDF (stored in a Module in VBE)
called from a cell along the lines of:![]()
Please Login or Register to view this content.
compares B1 to A1 - in this case returning 67%![]()
Please Login or Register to view this content.
(case sensitivity is optional)
Modify as appropriate.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Cheers DonkeyOte, pardon my ignorance but do I copy the UDF to a module in excel and then use the Compare String.
Thanks very much btw!
Yes, the Function would sit in a Module and then (in macro enabled file) you can call the function from a cell as outlined.
You might find the code doesn't do exactly what you want (it was configured for someone else a while back with specific requirements), however, hopefully it will help to some extent.
Thanks, I've not done something like this before.
Ok, just tried it and its returning #NAME? in the comparestring cell.
Any ideas? (I know Im doing something stupid here..)
Are Macros enabled ?
Did you store the UDF in a standard Module in VBE ? (eg Module1)
#NAME? generally results because the function name used is not recognised as "valid".
I'm assuming that macros are enabled as I can run them, but can I check that they are to be sure? And I copied and pasted the UDF into Module25. Would that be the problem?
For demo. see attached.
(if you get #NAME? errors with said attachment then VBA is not enabled)
Fantastic Donkey, cheers!!!
I'm an idiot btw :S
I had copied the UDF into a module on a different spreadsheet :D
and the worksheet wasn't named Sheet1.
Its working perfectly now, thanks very much!
% similarity between 2 cells of text, that was exactly my question. Many Thanks! regards, Jake
How this macro has to be changed if
I want to ignore prefix dot and it will give percent also if the words has wroten without space.
Column B = I have http://www. ( i want percent compare of domain name ) .com
Column A = Normal letters expect one prefix / which would be nice to ignore
Would it be possible ?
thanks : )
Pavbo, welcome to the forum
Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.
If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.
Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks