Fuzzy Lookup in Excel with Add-In & Power Query

Method 1 – Using Fuzzy Lookup Add-In

Step-01: Creation of Two Tables for Fuzzy Lookup Excel

Before using the Fuzzy Lookup option we have to convert the following two data ranges into two different tables.

fuzzy lookup Excel

Following the article “How to Make a Table in Excel” we have converted the ranges into these tables.

creating two tables

Rename these tables.
➤ Select the table for Sales Record of January and then go to Table Design Tab >> rename the Table Name as January.

creating two tables

Rename the Sales Record of February table as February.

fuzzy lookup Excel


Step – 02: Creating Fuzzy Lookup with Fuzzy Lookup Excel Add-In

➤ Go to Fuzzy Lookup Tab >> Fuzzy Lookup Option.

creating fuzzy lookup Excel

Get a Fuzzy Lookup portion on the right pane.
➤ Select the cell where you want your output comparison table.
➤ Choose the Left Table as January and the Right Table as February.

creating fuzzy lookup Excel

Select the columns on which we want this comparison. We want this comparison on the basis of the Product column and the SalesPerson column, so these columns are selected in the Left Columns and Right Columns boxes.

creating fuzzy lookup Excel

As Output Columns select the January.Product and January.SalesPerson from the January table and,

creating fuzzy lookup Excel

February.Product and Febuary.SalesPerson from the February table and finally,

creating fuzzy lookup Excel

Select the FuzzyLookup.Similarity for getting the percentage indication of similarities.

creating fuzzy lookup Excel

We selected the Number of Matches as 1 and the Similarity Threshold as 0.51 and then pressed Go.

creating fuzzy lookup Excel

We got matches for the Products Apple and Green Apple for the SalesPerson Howard and for Cherry, Blackberry, and Tomato which are fully matched as the similarity is 100%.

creating fuzzy lookup Excel


Effects of Changing Number of Matches and Similarity Threshold

Number of Matches:

For selecting the Number of Matches as 1,

fuzzy lookup Excel

We are getting the following comparison table where we have one similarity for each product, but we had Blackberry 2 times in the February table with different SalesPersons.

number of matches

If you select the Number of Matches as 2,

number of matches

You will get the matching results for these two Blackberry products with the SalesPerson Sheldon and Matt.

number of matches

Similarity Threshold:

Its range is between 0 and 1, and to move from the lower range to the higher range, we will move from partial match to exact match.

Try with a Similarity Threshold of 0.1.

similarity threshold

We are getting the similarities from 20% to 100%.

similarity threshold

For selecting the Similarity Threshold as 0.4,

similarity threshold

The similarity range is from 60% to 100%.

similarity threshold

When we have selected the Similarity Threshold range as 0.84,

similarity threshold

Then the similarity range is from 90% to 100%.

similarity threshold

For selecting the highest Similarity Threshold range like 1,

similarity threshold

Then you will get only the exact matches as the similarity range is 100%.

fuzzy lookup Excel


Method 2 – Power Query Fuzzy Matching Option

Step-01: Creation of Two Queries

For comparing the Product and SalesPerson columns of the January and February sales records, we will convert these two ranges into queries.

fuzzy lookup Excel

➤ Go to Data Tab >> From Table/Range option.

creation of two queries

The Create Table wizard will pop up.
➤ Select the range of your data table (we are selecting the data range of the Sales Record of January)
➤ Check My table has headers option and press OK.

creation of two queries

A Power Query editor will open up.
➤ Rename the query as January.

creation of two queries

We will import this data as a connection only.
➤ Go to Home Tab >> Close & Load Dropdown >> Close & Load To option.

creation of two queries

The Import Data dialog box will appear.
➤ Click on the Only Create Connection option and press OK.

creation of two queries

Create a query named February for the dataset Sales Record of February.

creation of two queries

We can see the names of the two queries in January and February that we created in this step.

fuzzy lookup Excel


Step-02: Combining Queries for Fuzzy Lookup Excel

We will combine the queries of the previous step to match the data of these queries.
➤ Go to Data Tab >> Get Data Dropdown >> Combine Queries Dropdown >> Merge Option.

fuzzy lookup Excel

The Merge wizard will pop up.

combining queries

➤ Click the dropdown of the first box and then select the January option.

combining queries

➤ Select the dropdown of the second box and then select the February option.

combining queries

Select the columns of the two queries by pressing CTRL with a Left-click at a time on the basis of which we want to match our data.

fuzzy lookup Excel

See that it has found 3 rows matching from 9 rows.


Step-03: Using the Fuzzy Matching Option for Fuzzy Lookup Excel

Use the Fuzzy Matching option to perform the partial matching beside the exact matches.
➤ Check the Use fuzzy matching to perform the merge option and then select the Similarity threshold as 0.5 for this option.

fuzzy lookup Excel

➤ Select the Ignore case option and the Match by combining text parts option.

using fuzzy matching option

We selected the Maximum number of matches as 1 and pressed OK.
See the matching number has been increased from 3 to 5.

using fuzzy matching option

You will be taken to the Power Query Editor window.
See the first two columns from the January query but the columns of the February query are hidden. So, we have to expand this February column.

➤ Click on the indicated sign beside February.

using fuzzy matching option

➤ Select the Expand option and press OK.

using fuzzy matching option

We can see the matches of the two queries properly.

fuzzy lookup Excel


Effects of Changing Similarity Threshold

If we change the Similarity threshold from 0.5 to 0.2, then we will have 8 matches in the place of 5 matches.

fuzzy lookup Excel

After pressing OK, we can see that, the other rows are partially similar to each other except for the first row.

using fuzzy matching option

If we select the Similarity threshold from 0.2 to 1, we will have 4 matches instead of 8 matches.

similarity threshold

The exact matches ignore cases only. We are having the results this time.

fuzzy lookup Excel


Things to Remember

The built-in lookup functions like the VLOOKUP function, HLOOKUP function are useful for exact matching cases, but for finding approximate matches according to our wish we can use the Fuzzy Lookup add-in of Excel.

To produce different results for matching cases, you can change the Number of Matches and Similarity Threshold parameters as per your necessity.


Download Practice Workbook


<< Go Back to Lookup | Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjima Hossain
Tanjima Hossain

TANJIMA HOSSAIN is a marine engineer who enjoys working with Excel and VBA programming. For her, programming is a handy, time-saving tool for managing data, files, and online tasks. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. She holds a B.Sc. in Naval Architecture & Marine Engineering from BUET and is now a content developer. In this role, she creates tech-focused content centred around Excel and VBA. Apart from... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo