Fuzzy Match Without Fuzzy Lookup Add in, Power Query and VBA

ashish002

New Member
Joined
Jul 5, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows
Hi,

Is there a formula to find out all the possible fuzzy/partial matches for a single value (there is only one column in the sheet)?

Column A has all the data (there are some duplicate values which can be found out using conditional formatting). Apart from that there are many values like Samsung, Samsung Inc, Samsung Corp, The Samsung)

If i type the formula in cell B1, it should give me all the possible partial match values for cell A1 and likewise

Note: Fuzzy Lookup add in, power query and vba cannot be used

Thanks in advance
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Ashish002,

SEARCH will do that for you.

Ashish202.xlsx
ABCD
1SamsungSamsungSamsung
2Samsung IncSamsung Inc
3Samsung CorpSamsung Corp
4The SamsungThe Samsung
5AppleMy Samsung LLC
6Apple Corp. 
7Apple Corp 
8VONS 
9The VONS 
10The Apple 
11My Samsung LLC 
12
Sheet1
Cell Formulas
RangeFormula
D1:D11D1=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:$A$9999)/(ISNUMBER(SEARCH($B$1,$A$1:$A$9999))),ROW())),"")
 
Upvote 0
An alternative is to use Power Query and join each column as a table in the Editor with a left outer join fuzzy match.

Power Query:
let
    Source = Table.FuzzyNestedJoin(Table2, {"Column1"}, Table1, {"Column1"}, "Table1", JoinKind.LeftOuter, [IgnoreCase=true, IgnoreSpace=true, Threshold=.5]),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Column1"}, {"Table1.Column1"})
in
    #"Expanded Table1"
 
Upvote 0
An alternative is to use Power Query and join each column as a table in the Editor with a left outer join fuzzy match.

Power Query:
let
    Source = Table.FuzzyNestedJoin(Table2, {"Column1"}, Table1, {"Column1"}, "Table1", JoinKind.LeftOuter, [IgnoreCase=true, IgnoreSpace=true, Threshold=.5]),
    #"Expanded Table1" = Table.ExpandTableColumn(Source, "Table1", {"Column1"}, {"Table1.Column1"})
in
    #"Expanded Table1"
Didn't work out in Excel 2016.

Thanks for your time.
 
Upvote 0
Hi Ashish002,

SEARCH will do that for you.

Ashish202.xlsx
ABCD
1SamsungSamsungSamsung
2Samsung IncSamsung Inc
3Samsung CorpSamsung Corp
4The SamsungThe Samsung
5AppleMy Samsung LLC
6Apple Corp. 
7Apple Corp 
8VONS 
9The VONS 
10The Apple 
11My Samsung LLC 
12
Sheet1
Cell Formulas
RangeFormula
D1:D11D1=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:$A$9999)/(ISNUMBER(SEARCH($B$1,$A$1:$A$9999))),ROW())),"")
Thanks a lot, It worked

Can we optimise this formula for a larger data set where the no. of rows are greater than 20000?
 
Upvote 0
Thanks a lot, It worked

Can we optimise this formula for a larger data set where the no. of rows are greater than 20000?
You're welcome!

I dummied up 25,000 rows of column A and copied down the column D formula 200 rows and it took about 2.5 seconds on my small laptop.

It's mostly a function of how many rows you copy down the AGGREGATE formula. (i.e. how many hits you may find). You could remove the IFERROR, if you're OK to get #NUM! errors after the last hit, which would give a marginal performance increase but apart from that I don't see how it could be made faster.

Ashish202.xlsx
ABCD
1SamsungAppleApple
2Samsung IncApple Corp.
3Samsung CorpApple Corp
4The SamsungThe Apple
5AppleApple
6Apple Corp.Apple Corp.
7Apple CorpApple Corp
8VONSThe Apple
9The VONSApple
10The AppleApple Corp.
Sheet1 (2)
Cell Formulas
RangeFormula
D1:D10D1=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:$A$25000)/(ISNUMBER(SEARCH($B$1,$A$1:$A$25000))),ROW())),"")
 
Upvote 0
Solution
You're welcome!

I dummied up 25,000 rows of column A and copied down the column D formula 200 rows and it took about 2.5 seconds on my small laptop.

It's mostly a function of how many rows you copy down the AGGREGATE formula. (i.e. how many hits you may find). You could remove the IFERROR, if you're OK to get #NUM! errors after the last hit, which would give a marginal performance increase but apart from that I don't see how it could be made faster.

Ashish202.xlsx
ABCD
1SamsungAppleApple
2Samsung IncApple Corp.
3Samsung CorpApple Corp
4The SamsungThe Apple
5AppleApple
6Apple Corp.Apple Corp.
7Apple CorpApple Corp
8VONSThe Apple
9The VONSApple
10The AppleApple Corp.
Sheet1 (2)
Cell Formulas
RangeFormula
D1:D10D1=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:$A$25000)/(ISNUMBER(SEARCH($B$1,$A$1:$A$25000))),ROW())),"")
Thanks again for all your help.
 
Upvote 0
What does this mean? Need more explanation to help. It worked for me.

Didn't work out in Excel 2016.

Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
What does this mean? Need more explanation to help. It worked for me.


Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
I tried again using the code. I pasted the code as is in the blank query editor and when i clicked on done, it showed me expression error saying table.fuzzynestedjoin wasn't recognized.

Please let me know if am doing something wrong.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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