Fuzzy Matching - new version plus explanation

al_b_cnu

Well-known Member
Joined
Jul 18, 2003
Messages
4,545
It has been a while since I originally posted my Fuzzy matching UDF’s on the board, and several variants have appeared subsequently.

I thought it time to ‘put the record straight’ & post a definitive version which contains slightly more efficient code, and better matching algorithms, so here it is.

Firstly, I must state that the Fuzzy matching algorithms are very CPU hungry, and should be used sparingly. If for instance you require to lookup a match for a string which starts with, contains or ends with a specified value, this can be performed far more efficiently using the MATCH function:
Fuzzy Examples.xls
ABCDE
1Starts WithEndsContains
2BilljelenBill
3Mr Bill Jelen433
4Bill Jelen
5Joe Bloggs
6Fred Smith
MATCH Example


... Continued ...
 
Alan,
Is fuzzyvlookup only available with vba codes?
Cannot be done with formulas only?
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi amyl, I'm afraid so, but suggest you firstly check out post #1 of this thread.

That said, implementing isnt as daunting as it may first appear :)
 
Upvote 0
Haha, you may think so, but I am the type of person who needs someone to sit beside me and show me this this this, then I know what to do.
Like, with the VBA codes that i put in Microsoft Visual Basic, okay, the codes is in there now, so, what's next?
 
Upvote 0
Treat it like VLookup (except theparameters are different.)

What is the layout in your s/sheet ?
 
Upvote 0
Hi amyl, could you adapt this:
<b>Excel 2003</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #A6AAB6"><colgroup><col width="25px" style="background-color: #E0E0F0" /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #E0E0F0;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style="font-weight: bold;;">Company</td><td style="text-align: right;;"></td><td style=";">Lookup Value</td><td style=";">Best Match Row</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Bodgitt and Run</td><td style="text-align: right;;"></td><td style=";">Adam&Benett</td><td style="text-align: right;;">6</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">Alpha beta gamma</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">delta epsilon </td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">zeta theta</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">Adam and Benett Enterprise</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style=";">iota Kappa</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #A6AAB6;border-top:none;text-align: center;background-color: #E0E0F0;color: #161120">Sheet1</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #A6AAB6"><thead><tr style=" background-color: #E0E0F0;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #E0E0F0;color: #161120">D2</th><td style="text-align:left">=FuzzyVLookup(<font color="Blue">C2,A:A,0,,,2</font>)</td></tr></tbody></table></td></tr></table><br />

Note that I have used algorithm 2 which may be the most appropriate for your requirements
 
Upvote 0
I was using something like this
=vlookup("*"&Cell&"*",table array, column, argument)
didn't return me any results. Don't work for numbers I guess?
I posted a query on this with example js a few hours ago and I'm still awaiting for reply.
 
Upvote 0
No Alan,
I hadn't put the VBA codes in. that is why it didn't work for me.
I have tried doing Alt+F11 and it gives me Microsoft Visual Basic.
On that top left screen, I click on the View Code button Book 1, Module 1 (Code) and I entered the codes. Then, what's next?
 
Upvote 0
I saw what we have to do on Post #4,
didn't have to save, didn't have to drag, just paste the formula and we are set to go? Unfortunately, nothing happened!
ANd now, when i opened my VBA, it's all hanging, No codes, All blanks on my left window..
 
Upvote 0
how is your worksheet laid out?
what formula have you entered?
If you've entered the FuzzyVLooklup formule, it should either
(a) return a value, or
(b) return an error such as '#NAME?' '#N/A' or '#VALUE'

Is it possible for you to post an sample of your table and also your formula via ,e.g. HTMLMaker?
 
Upvote 0

Forum statistics

Threads
1,216,190
Messages
6,129,422
Members
449,509
Latest member
ajbooisen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top