Fuzzy Matching - new version plus explanation

al_b_cnu

Well-known Member
Joined
Jul 18, 2003
Messages
4,546
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 ...
 
Thanks Jeffrey for your reply. Actually I've got two set of data in two worksheets. There are three columns inside the both eorksheet.
1. Company Name
2. User Name
3. Company Name & User Name

Basically I would like to do fuzzy match for "Company Name & User Name" in spreadsheet 1 (1000 records) with spreadsheet 2 (800000 records) and return the result if it matches 90% or above.

Both spreadsheet's data was extracted from two different sources which was manually input by users before. There may be typo or different on the names, e.g. Co. vs Company or Ltd vs Limited. Therefore, I would like to use fuzzy match to do the matching but the amount of data is huge and slow...

yam1314 - multithreading or not you're asking a lot of Excel. Can you post a sample of the data you're trying to match and some of the search terms that you would like them matched against? This might help point out an alternative approach, such as judicios use of wildcard matching via VLOOKUP, or creative use of wildcards in find and replace to make large amounts of your terms conform with your lookup table. Also, will there be any direct matches in the data? If so, approximately how many? If lots, then do direct matches with a traditional VLOOKUP, and then remove those from the remaining data.
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
What you want to do is reduce the amount of terms that require fuzzy matching. So:
1. Use Find and Replace to remove all instances of ltd, limited, co, company, inc, incorporated etc out of both sets of data. i.e. replace ltd with "". Note that Find and Replace lets you use wildcards so you can also get rid of incorporation dates by using (19??) and (20??) as your 'find' terms.
2. use TRIM to get rid of any extra spaces in what you have left. So if your company names are in A1:A1000 then in B1:B1000 put =TRIM(A1)
3. Do a standard VLOOKUP with exact match (i.e. =VLOOKUP(Company, LookupTable, somerow, FALSE) to get Excel to match the easy matches. Filter the result on =#N/A! and copy what's left - the unmatched records - to a new table. How many are left?
4. Eyeball that list of remainers, work out if there are any more generic terms you can substitute out of both the small list and the large list to get exact matches. If so, repeat steps 1 to 3 using the new replacement terms you devise.

Note that Andrew Engwirda has a great multi-field Find and Replace tool explained at Andrew's Excel Tips: Find and Select / Replace with Multiple Fields that will be helpful with this. (Actual download page is at http://www.andrewsexceltips.net/AET_Find_And_Replace.zip )
 
Upvote 0
Hi All,
Can someone please point me in the direction to the latest version of the code? I would like to copy the code and paste it over the code i have, which is many years old now.
Thank you
Barry
 
Upvote 0
Hi guys,

I skimmed through the entirety of this thread looking to see if there was something that could help me and I'm not entirely sure if a solution exists for me using this UDF or not.

I've got two columns full of names of companies and I am simply trying to count how many times there is a fuzzy match above say, 80%.

My data looks like this:

[table="width: 500"]
[tr]
[td]Company List to compare against[/td]
[td]Company List to match[/td]
[td]# Match[/td]
[/tr]
[tr]
[td]George Washington[/td]
[td]George Smith[/td]
[td]3[/td]
[/tr]
[tr]
[td]George Moon[/td]
[td]Albert Door[/td]
[td]0[/td]
[/tr]
[tr]
[td]George Excel[/td]
[tdPaper Pen][/td]
[td]0[/td]
[/tr]
[/table]
 
Upvote 0
Edit:

hi guys,

i skimmed through the entirety of this thread looking to see if there was something that could help me and i'm not entirely sure if a solution exists for me using this udf or not.

I've got two columns full of names of companies and i am simply trying to count how many times there is a fuzzy match above say, 80%.

My data looks like this:

[table="width: 500"]
[tr]
[td]company list to compare against[/td]
[td]company list to match[/td]
[td]# match[/td]
[/tr]
[tr]
[td]george washington[/td]
[td]george smith[/td]
[td]3[/td]
[/tr]
[tr]
[td]george moon[/td]
[td]albert door[/td]
[td]0[/td]
[/tr]
[tr]
[td]george excel[/td]
[td]paper pen][/td]
[td]0[/td]
[/tr]
[/table]
 
Upvote 0

Maybe I'm not fully awake, but if that's your goal, simply have your 2 lists on separate sheets and run your fuzzy formula in one or both of them. Easy enough to count the number of times the results are not N/A from there, yes?
 
Upvote 0
I've read through the entire thread, and wasn't able to find the solution to the problem I'm facing. I've looked at other Fuzzy Lookup scripts, and none have had the support or functionality that this one appears to have. I'll give a brief outline of the problem I'd like to solve, and if there is a post I missed that solves this issue you can point me to it.

The Short Version:
I need to match two fields exactly (NPI and Tax ID) which exist in both tables and then identify the unique system identifier associated with any addresses associated with the paired identifiers which could have formatting differences between the two databases (fuzzy lookup).

I can easily use the FuzzyVLookup and FuzzyPercent code supplied to do the second part, but for some reason I'm struggling to figure out a way to do the next part.

The Long Version:
I am trying to reconcile data between two databases to incorporate any changes and new data into Database A from Database B. Both databases store a Medical Provider's NPI, Tax ID, and Address (along with a bunch of other information not relevant to this problem). The primary difference is that Database A indexes the data utilizing a unique identifier for each NPI, then adds a numbered prefix for each entry with a unique Tax ID and Address. Both pieces of the unique identifier are concatenated to form the Unique ID. Database B does not do this. Because the NPI is unique to each medical provider, and Tax ID to a specific practice, these cannot vary at all between the two. If they do, that's something completely different I need to identify elsewhere.

Ideally, I've broken this into a couple of tasks that should make this easier.
First: Exact Match NPI and Tax ID from B --> A
Then: Of the Exactly Matched sets, FuzzyMatch Address from B --> A to Pull Unique Identifier with Level of Confidence in adjacent column

I've considered that a For Each statement but that seems completely inefficient. I'm not sure how to write efficient code that will track both exact matches paired with the fuzzy match.

I'm pretty good at hacking apart code and making it work, but thus far this has proven beyond my skill level. Help would be appreciated.
 
Upvote 0
Hello everybody,

I'm facing an issue with the Excel fuzzy lookup addin, so before trying another solution (VBA routines ?), I'm wondering if someone would have an advice about my lookup problem...
Indeed I have a very big volume to process (3000 lines in the left table, and 100 000 lines in the right table), and seems that excel add in would be the better solution (if it would work as expected...)

Let me explain my problem:
I try to match cities between 2 tables. I have the city code and the city name
Nb: Checking only the city code would not be sufficient, because sometimes, the city code could be the same, but represent a totally different city (so the name of the city is different) ! So I also need to check the name.

But the following example is not correctly handled by the add in:

TABLE 1
[TABLE="width: 500"]
<tbody>[TR]
[TD]City code1[/TD]
[TD]City name1[/TD]
[/TR]
[TR]
[TD]BEBRU[/TD]
[TD]BRUXELLES[/TD]
[/TR]
</tbody>[/TABLE]


TABLE 2
[TABLE="width: 500"]
<tbody>[TR]
[TD]City code2[/TD]
[TD]City name2[/TD]
[/TR]
[TR]
[TD]BEBRU[/TD]
[TD]BRUSSELS[/TD]
[/TR]
[TR]
[TD]BEBRV[/TD]
[TD]BRUYELLES[/TD]
[/TR]
</tbody>[/TABLE]


Expected result :
[TABLE="width: 500"]
<tbody>[TR]
[TD]City code1[/TD]
[TD]City name1[/TD]
[TD]City code2[/TD]
[TD]City name2[/TD]
[/TR]
[TR]
[TD]BEBRU [/TD]
[TD]BRUXELLES [/TD]
[TD]BEBRU [/TD]
[TD]BRUSSELS[/TD]
[/TR]
</tbody>[/TABLE]



1/When I use the default matching method of the addin
- matching condition : City code1,City name1 <--> City code2,City name2 (default matching method)

result is wrong :

[TABLE="width: 500"]
<tbody>[TR]
[TD]City code1[/TD]
[TD]City name1[/TD]
[TD]City code2[/TD]
[TD]City name2[/TD]
[/TR]
[TR]
[TD]BEBRU [/TD]
[TD]BRUXELLES [/TD]
[TD]BEBRV[/TD]
[TD]BRUYELLES[/TD]
[/TR]
</tbody>[/TABLE]

Ok I could understand BEBRU/BEBRV and BRUXELLES/BRUYELLES are very similar

2/So I try to use 2 matching conditions to improve the matching:
- matching condition 1 : City code1 <--> City code2 (Exact matching method)
- matching condition 2 : City name1 <--> City name2 (default matching method)

but result is the same and is wrong
while I specified that the city code must be the same... In this case I don't understand why the add in is not able to give the correct result .

NB: 1 workaround would be to execute the step 1/, then in Excel check with formula if city codes are the same. If yes, matching is relevant, otherwise it isn't.
OK, but I don't understand why the add in result is not correct in the step 2/, while it enables to use 2 specifics and differents conditions (1 exact condition, and 1 default condition)

So :
* Am I missed something ?
* Is there any way to achieve my need ? (Force an exact matching to 1 field, and make the fuzzy search on a second field, and combine the 2 condition), with this add in ?
* IS the VBA routines could be used in this case ? As explained, the second problem I have is the volume of data...


Thank you for your help.
 
Upvote 0
Hi,

I'm looking for a bit of assistance, I have two files csv files of addresses and am trying to match them.

File 1

A CSV file received from another department and it had the following columns:
Column A = PropertyAddress1
Column B = PropertyAddress2
Column C = PropertyAddress3
Column D = PropertyAddressTown
Column E = PropertyAddressCounty
Column F = PropertyAddressPostcode

I’ve removed the PropertyAddress3 and the PropertyAddressCounty columns as they didn’t contain very much information, most of them were empty cells.

Each part of the address in this file is in a different column and some lines of the address are in the same cell and separated by a comma.

The addresses aren’t standardised and don’t always match the address on our system, sometimes the postcodes are different too. This file contains 5,905 entries.

File 2

A CSV file extracted from our system and it has the following columns:
Column A = Address
Column B = Response
Column C = UPRN

The address in this file is all in one cell and separated by commas. This file contains 48,486 entries (all the properties on our database).

What I’ve done so far

I concatenated the address information in File 1 and removed all punctuation and spaces, so that the address appeared as a single string in column E.

Then in File 2 I removed all the punctuation and spaces so that the address information in both files would be one string of information.

I then copied the information from File 2 into a new tab in File 1 and called the new tab System Addresses.

In File 1 in the column beside the concatenated address information I entered the following formula:
=VLOOKUP(E2,'System Addresses'!A:A,1,FALSE)

Using this formula I managed to match 2,623 entries out of the 5,905 – so about 44%.

I then managed to match some more using a vlookup based on the first line of the address and the postcode, some of them did match, but some matched in error, especially flats.

I'm using the following code:
Option Explicit
Type RankInfo
Offset As Integer
Percentage As Single
End Type


Function FuzzyPercent(ByVal String1 As String, _
ByVal String2 As String, _
Optional Algorithm As Integer = 3, _
Optional Normalised As Boolean = False) As Single
'*************************************
'** Return a % match on two strings **
'*************************************
Dim intLen1 As Integer, intLen2 As Integer
Dim intCurLen As Integer
Dim intTo As Integer
Dim intPos As Integer
Dim intPtr As Integer
Dim intScore As Integer
Dim intTotScore As Integer
Dim intStartPos As Integer
Dim strWork As String


'-------------------------------------------------------
'-- If strings havent been normalised, normalise them --
'-------------------------------------------------------
If Normalised = False Then
String1 = LCase$(Application.Trim(String1))
String2 = LCase$(Application.Trim(String2))
End If


'----------------------------------------------
'-- Give 100% match if strings exactly equal --
'----------------------------------------------
If String1 = String2 Then
FuzzyPercent = 1
Exit Function
End If


intLen1 = Len(String1)
intLen2 = Len(String2)


'----------------------------------------
'-- Give 0% match if string length < 2 --
'----------------------------------------
If intLen1 < 2 Then
FuzzyPercent = 0
Exit Function
End If


intTotScore = 0 'initialise total possible score
intScore = 0 'initialise current score


'--------------------------------------------------------
'-- If Algorithm = 1 or 3, Search for single characters --
'--------------------------------------------------------
If (Algorithm And 1) <> 0 Then
FuzzyAlg1 String1, String2, intScore, intTotScore
If intLen1 < intLen2 Then FuzzyAlg1 String2, String1, intScore, intTotScore
End If


'-----------------------------------------------------------
'-- If Algorithm = 2 or 3, Search for pairs, triplets etc. --
'-----------------------------------------------------------
If (Algorithm And 2) <> 0 Then
FuzzyAlg2 String1, String2, intScore, intTotScore
If intLen1 < intLen2 Then FuzzyAlg2 String2, String1, intScore, intTotScore
End If


FuzzyPercent = intScore / intTotScore


End Function
Private Sub FuzzyAlg1(ByVal String1 As String, _
ByVal String2 As String, _
ByRef Score As Integer, _
ByRef TotScore As Integer)
Dim intLen1 As Integer, intPos As Integer, intPtr As Integer, intStartPos As Integer


intLen1 = Len(String1)
TotScore = TotScore + intLen1 'update total possible score
intPos = 0
For intPtr = 1 To intLen1
intStartPos = intPos + 1
intPos = InStr(intStartPos, String2, Mid$(String1, intPtr, 1))
If intPos > 0 Then
If intPos > intStartPos + 3 Then 'No match if char is > 3 bytes away
intPos = intStartPos
Else
Score = Score + 1 'Update current score
End If
Else
intPos = intStartPos
End If
Next intPtr
End Sub
Private Sub FuzzyAlg2(ByVal String1 As String, _
ByVal String2 As String, _
ByRef Score As Integer, _
ByRef TotScore As Integer)
Dim intCurLen As Integer, intLen1 As Integer, intTo As Integer, intPtr As Integer, intPos As Integer
Dim strWork As String


intLen1 = Len(String1)
For intCurLen = 2 To intLen1
strWork = String2 'Get a copy of String2
intTo = intLen1 - intCurLen + 1
TotScore = TotScore + Int(intLen1 / intCurLen) 'Update total possible score
For intPtr = 1 To intTo Step intCurLen
intPos = InStr(strWork, Mid$(String1, intPtr, intCurLen))
If intPos > 0 Then
Mid$(strWork, intPos, intCurLen) = String$(intCurLen, &H0) 'corrupt found string
Score = Score + 1 'Update current score
End If
Next intPtr
Next intCurLen


End Sub


Function FuzzyVLookup(ByVal LookupValue As String, _
ByVal TableArray As Range, _
ByVal IndexNum As Integer, _
Optional NFPercent As Single = 0.05, _
Optional Rank As Integer = 1, _
Optional Algorithm As Integer = 3, _
Optional AdditionalCols As Integer = 0) As Variant
'********************************************************************************
'** Function to Fuzzy match LookupValue with entries in **
'** column 1 of table specified by TableArray. **
'** TableArray must specify the top left cell of the range to be searched **
'** The function stops scanning the table when an empty cell in column 1 **
'** is found. **
'** For each entry in column 1 of the table, FuzzyPercent is called to match **
'** LookupValue with the Table entry. **
'** 'Rank' is an optional parameter which may take any value > 0 **
'** (default 1) and causes the function to return the 'nth' best **
'** match (where 'n' is defined by 'Rank' parameter) **
'** If the 'Rank' match percentage < NFPercent (Default 5%), #N/A is returned. **
'** IndexNum is the column number of the entry in TableArray required to be **
'** returned, as follows: **
'** If IndexNum > 0 and the 'Rank' percentage match is >= NFPercent **
'** (Default 5%) the column entry indicated by IndexNum is **
'** returned. **
'** if IndexNum = 0 and the 'Rank' percentage match is >= NFPercent **
'** (Default 5%) the offset row (starting at 1) is returned. **
'** This value can be used directly in the 'Index' function. **
'** **
'** Algorithm can take one of the following values: **
'** Algorithm = 1: **
'** This algorithm is best suited for matching mis-spellings. **
'** For each character in 'String1', a search is performed on 'String2'. **
'** The search is deemed successful if a character is found in 'String2' **
'** within 3 characters of the current position. **
'** A score is kept of matching characters which is returned as a **
'** percentage of the total possible score. **
'** Algorithm = 2: **
'** This algorithm is best suited for matching sentences, or **
'** 'firstname lastname' compared with 'lastname firstname' combinations **
'** A count of matching pairs, triplets, quadruplets etc. in 'String1' and **
'** 'String2' is returned as a percentage of the total possible. **
'** Algorithm = 3: Both Algorithms 1 and 2 are performed. **
'********************************************************************************
Dim R As Range


Dim strListString As String
Dim strWork As String


Dim sngMinPercent As Single
Dim sngWork As Single
Dim sngCurPercent As Single
Dim intBestMatchPtr As Integer
Dim intRankPtr As Integer
Dim intRankPtr1 As Integer
Dim I As Integer


Dim lEndRow As Long


Dim udRankData() As RankInfo


Dim vCurValue As Variant


'--------------------------------------------------------------
'-- Validation --
'--------------------------------------------------------------


LookupValue = LCase$(Application.Trim(LookupValue))


If IsMissing(NFPercent) Then
sngMinPercent = 0.05
Else
If (NFPercent <= 0) Or (NFPercent > 1) Then
FuzzyVLookup = "*** 'NFPercent' must be a percentage > zero ***"
Exit Function
End If
sngMinPercent = NFPercent
End If


If Rank < 1 Then
FuzzyVLookup = "*** 'Rank' must be an integer > 0 ***"
Exit Function
End If


ReDim udRankData(1 To Rank)


lEndRow = TableArray.Rows.Count
If VarType(TableArray.Cells(lEndRow, 1).Value) = vbEmpty Then
lEndRow = TableArray.Cells(lEndRow, 1).End(xlUp).Row
End If


'---------------
'-- Main loop --
'---------------
For Each R In Range(TableArray.Cells(1, 1), TableArray.Cells(lEndRow, 1))
vCurValue = ""
For I = 0 To AdditionalCols
vCurValue = vCurValue & R.Offset(0, I).Text
Next I
If VarType(vCurValue) = vbString Then
strListString = LCase$(Application.Trim(vCurValue))

'------------------------------------------------
'-- Fuzzy match strings & get percentage match --
'------------------------------------------------
sngCurPercent = FuzzyPercent(String1:=LookupValue, _
String2:=strListString, _
Algorithm:=Algorithm, _
Normalised:=True)

If sngCurPercent >= sngMinPercent Then
'---------------------------
'-- Store in ranked array --
'---------------------------
For intRankPtr = 1 To Rank
If sngCurPercent > udRankData(intRankPtr).Percentage Then
For intRankPtr1 = Rank To intRankPtr + 1 Step -1
With udRankData(intRankPtr1)
.Offset = udRankData(intRankPtr1 - 1).Offset
.Percentage = udRankData(intRankPtr1 - 1).Percentage
End With
Next intRankPtr1
With udRankData(intRankPtr)
.Offset = R.Row
.Percentage = sngCurPercent
End With
Exit For
End If
Next intRankPtr
End If

End If
Next R


If udRankData(Rank).Percentage < sngMinPercent Then
'--------------------------------------
'-- Return '#N/A' if below NFPercent --
'--------------------------------------
FuzzyVLookup = CVErr(xlErrNA)
Else
intBestMatchPtr = udRankData(Rank).Offset - TableArray.Cells(1, 1).Row + 1
If IndexNum > 0 Then
'-----------------------------------
'-- Return column entry specified --
'-----------------------------------
FuzzyVLookup = TableArray.Cells(intBestMatchPtr, IndexNum)
Else
'-----------------------
'-- Return offset row --
'-----------------------
FuzzyVLookup = intBestMatchPtr
End If
End If
End Function
Function FuzzyHLookup(ByVal LookupValue As String, _
ByVal TableArray As Range, _
ByVal IndexNum As Integer, _
Optional NFPercent As Single = 0.05, _
Optional Rank As Integer = 1, _
Optional Algorithm As Integer = 3) As Variant
'********************************************************************************
'** Function to Fuzzy match LookupValue with entries in **
'** row 1 of table specified by TableArray. **
'** TableArray must specify the top left cell of the range to be searched **
'** The function stops scanning the table when an empty cell in row 1 **
'** is found. **
'** For each entry in row 1 of the table, FuzzyPercent is called to match **
'** LookupValue with the Table entry. **
'** 'Rank' is an optional parameter which may take any value > 0 **
'** (default 1) and causes the function to return the 'nth' best **
'** match (where 'n' is defined by 'Rank' parameter) **
'** If the 'Rank' match percentage < NFPercent (Default 5%), #N/A is returned. **
'** IndexNum is the row number of the entry in TableArray required to be **
'** returned, as follows: **
'** If IndexNum > 0 and the 'Rank' percentage match is >= NFPercent **
'** (Default 5%) the row entry indicated by IndexNum is **
'** returned. **
'** if IndexNum = 0 and the 'Rank' percentage match is >= NFPercent **
'** (Default 5%) the offset col (starting at 0) is returned. **
'** This value can be used directly in the 'OffSet' function. **
'** **
'** Algorithm can take one of the following values: **
'** Algorithm = 1: **
'** For each character in 'String1', a search is performed on 'String2'. **
'** The search is deemed successful if a character is found in 'String2' **
'** within 3 characters of the current position. **
'** A score is kept of matching characters which is returned as a **
'** percentage of the total possible score. **
'** Algorithm = 2: **
'** A count of matching pairs, triplets, quadruplets etc. in 'String1' and **
'** 'String2' is returned as a percentage of the total possible. **
'** Algorithm = 3: Both Algorithms 1 and 2 are performed. **
'********************************************************************************
Dim R As Range


Dim strListString As String
Dim strWork As String


Dim sngMinPercent As Single
Dim sngWork As Single
Dim sngCurPercent As Single


Dim intBestMatchPtr As Integer
Dim intPtr As Integer
Dim intRankPtr As Integer
Dim intRankPtr1 As Integer


Dim iEndCol As Integer


Dim udRankData() As RankInfo


Dim vCurValue As Variant
'--------------------------------------------------------------
'-- Validation --
'--------------------------------------------------------------
LookupValue = LCase$(Application.Trim(LookupValue))


If IsMissing(NFPercent) Then
sngMinPercent = 0.05
Else
If (NFPercent <= 0) Or (NFPercent > 1) Then
FuzzyHLookup = "*** 'NFPercent' must be a percentage > zero ***"
Exit Function
End If
sngMinPercent = NFPercent
End If


If Rank < 1 Then
FuzzyHLookup = "*** 'Rank' must be an integer > 0 ***"
Exit Function
End If


ReDim udRankData(1 To Rank)
'**************************
iEndCol = TableArray.Columns.Count
If VarType(TableArray.Cells(1, iEndCol).Value) = vbEmpty Then
iEndCol = TableArray.Cells(1, iEndCol).End(xlToLeft).Column
End If


'---------------
'-- Main loop --
'---------------
For Each R In Range(TableArray.Cells(1, 1), TableArray.Cells(1, iEndCol))
vCurValue = R.Value
If VarType(vCurValue) = vbString Then
strListString = LCase$(Application.Trim(vCurValue))

'------------------------------------------------
'-- Fuzzy match strings & get percentage match --
'------------------------------------------------
sngCurPercent = FuzzyPercent(String1:=LookupValue, _
String2:=strListString, _
Algorithm:=Algorithm, _
Normalised:=True)

If sngCurPercent >= sngMinPercent Then
'---------------------------
'-- Store in ranked array --
'---------------------------
For intRankPtr = 1 To Rank
If sngCurPercent > udRankData(intRankPtr).Percentage Then
For intRankPtr1 = Rank To intRankPtr + 1 Step -1
With udRankData(intRankPtr1)
.Offset = udRankData(intRankPtr1 - 1).Offset
.Percentage = udRankData(intRankPtr1 - 1).Percentage
End With
Next intRankPtr1
With udRankData(intRankPtr)
.Offset = R.Column
.Percentage = sngCurPercent
End With
Exit For
End If
Next intRankPtr
End If

End If
Next R


If udRankData(Rank).Percentage < sngMinPercent Then
'--------------------------------------
'-- Return '#N/A' if below NFPercent --
'--------------------------------------
FuzzyHLookup = CVErr(xlErrNA)
Else
intBestMatchPtr = udRankData(Rank).Offset - TableArray.Cells(1, 1).Column + 1
If IndexNum > 0 Then
'-----------------------------------
'-- Return row entry specified --
'-----------------------------------
FuzzyHLookup = TableArray.Cells(IndexNum, intBestMatchPtr)
Else
'-----------------------
'-- Return offset col --
'-----------------------
FuzzyHLookup = intBestMatchPtr
End If
End If
End Function



and using the following formula:
=fuzzyvlookup(E2,'System Addresses'!A:A,1,60%,1,2,0)

Even at 60% if returns an address, it's not always correct.

I'm probably going wrong somewhere, but hopefully someone on here can assist.

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,573
Members
452,652
Latest member
eduedu

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