Standard Excel lookups are perfectionists that fail on typos or extra spaces. While you could hack a solution using nested XLOOKUP, TRIM, and LOWER functions, it's brittle and hard to maintain. Power Query fuzzy matching is the smarter, "close enough" way to work.

Power Query uses a sophisticated fuzzy matching algorithm to calculate a similarity score between two strings, bridging the gap between "Microsoft" and "Mcrosoft" without a single manual edit. This means you can merge messy exports with cleaner master databases in seconds.

The full Power Query experience—including creating and editing queries—is natively available in Excel for Microsoft 365 (desktop), Excel for the web (Business and Enterprise plans), and Power BI.

The goal: A tale of two tables

Imagine you have a sales report (T_Sales, orange) full of manual entries, and you need to pull the sales region from a master table (T_Master, green).

An orange Excel table with misspelled company names in the first column and sales totals in the second column, and a green Excel table with Name and Region.

To follow along as you read this guide, download a free copy of the Excel workbook used in the examples. After clicking the link, you'll find the download button in the top-right corner of your screen.

However, because of typos and different naming conventions in T_Sales, a standard XLOOKUP would return #N/A for pretty much every lookup. So, we need Excel to look at the names in T_Sales, find the closest match in T_Master, and return the region, even if the spelling is slightly off.

To handle specific business shorthand that no algorithm can guess (like "MSFT"), you also need a small bridge table (T_Abbrev, blue) with From and To column headers. Make sure this table is ready before you begin.

An Excel worksheet with a table named T_Sales, a second named T_Master, and a third named T_Abbrev.

Step 1: Import your data using connections

Before letting the algorithm loose, you need to bring all three tables into the Power Query engine. Start by ensuring your data ranges are formatted as Excel tables (Ctrl+T). Then, import the first table by selecting any cell in the table and clicking Data > From Table/Range.

A cell in an Excel table is selected, and From Table or Range in the Data tab is highlighted.

To avoid cluttering your workbook, don't click the standard "Close & Load" button after importing each table to Power Query. Instead, click the down arrow and select "Close & Load To."

The Close and Load drop-down menu in Power Query Editor is expanded, and Close and Load To is selected.

Then, in the Import Data dialog, select "Only Create Connection," and click "OK."

Only Create Connection in Excel's Import Data dialog is checked.

After you've repeated this process for all three tables, you'll see them as connections only in the Queries & Connections pane (which opens automatically after you create the first connection), ready for the merge.

Three tables are listed as connections only in the Queries and Connections pane in Microsoft Excel.

Step 2: Merge your tables to begin the cleanup

To begin the cleanup, right-click "T_Sales" in the Queries & Connections pane and select "Merge."

T_Sales in Excel's Queries and Connections pane is right-clicked, and Merge is selected in the resultant menu.

Then, in the Merge dialog, select "T_Master" as the second table, and in both table previews, select the "Name" column. Essentially, you're telling Excel that you want to smash the T_Sales and T_Master tables together, and the Name column is what connects them.

Excel's Merge dialog, with the Name column in the T_Sales and T_Master tables selected.

Now, check "Use fuzzy matching to perform the merge" to tell Excel that some of the connections aren't perfect due to typos or inconsistent naming conventions. Under the hood, the Ignore Case option is checked by default, meaning "MICROSOFT" will correctly match "microsoft" without any extra steps. For the Join Kind, stick with "Left Outer"—this ensures you keep every sales transaction while simply tagging on the matching regional info.

The Use Fuzzy matching to perform the merge checkbox is checked in Excel's Merge dialog.

Step 3: Dial in the similarity threshold

OK, so you've told Excel which tables you're merging, the connecting variable, and that the matches aren't exact. Now, you need to set the threshold.

Click the arrow next to "Fuzzy matching options."

The Fuzzy matching expansion arrow in the Merge dialog in Excel.

The similarity threshold is a scale from 0.00 to 1.00, where 0.00 matches all values with any level of similarity, and 1.00 matches only exact values. Notice in the screenshot above that three of the six rows are matched. This is because Power Query defaults to a 0.80 similarity threshold. At this level, the engine is strict—it easily catches "Microsoft Inc" but fails on more aggressive typos like "Appel" or "Gogle."

In this case, a threshold of 0.50 is low enough to catch "Appel" and "Gogle" without accidentally matching unrelated words. It finds five out of six rows, leaving only the "MSFT" abbreviation unmatched.

The fuzzy matching threshold in Excel is set to .5, and the evaluation confirms that 5 of 6 rows are matched.

Step 4: Apply the transformation table for abbreviations

No algorithm is smart enough to know that "MSFT" means Microsoft. This is where the T_Abbrev table comes into play—in the Transformation Table drop-down menu, click "T_Abbrev," and this forces the engine to treat your manual overrides as perfect matches. Once selected, your match count at the bottom will jump to a perfect six of six.

The table named T_Abbrev is selected in the Transformation table drop-down menu in Excel's Merge dialog, and the selection match is 6 of 6.

Step 5: Clean up and summarize your final report

When you click "OK," you're taken to the Power Query Editor with a new column full of table results.

The Power Query Editor shows a column of Table results.

Click the "Expand" icon in the column header, uncheck "Use original column name as prefix" to prevent clunky headers like T_Master.Name, and click "OK."

The Table expansion arrow in the header of a T_Master column in Power Query Editor is clicked, and the checkbox for original names is unchecked.

You can see that the names are now standardized in a new Name.1 column and the regions are appended in a new Region column.

A Name.1 column and Region column in Power Query Editor, inserted using fuzzy matching in a merge.

From here, remove the original messy Name column (right-click the column header and select "Remove"), click and drag the new Name column to the left so that it's the first column in the table, and rename it (double-click the column header) to something like Official Name. While you're there, make sure that the correct data types are assigned to each column by clicking the icons in the column headers.

A transformed table in the Power Query Editor with consistent company names and a merged Region column.

Because this process tags every individual transaction, you end up with multiple rows for the same company. To turn this into a clean report, in the Transform tab, click "Group By."

The Group By button in the Power Query Editor.

Then, in the Group By dialog, select the "Advanced" radio button at the top. This lets you group by multiple columns at once. In this case, we want to group by the Name and Region columns. To do this, for the first grouping, select "Official Name." Then, click "Add grouping," and select "Region."

The Advanced option in the Power Query Group By dialog is checked, and the Official Name and Region columns are selected.

Now, set the calculation. In the New column name field, type Total Sales, in the Operation field, select "Sum," and in the Column field, select "Sales."

The New Column Name, Operation, and Column fields in the Power Query Group By dialog are populated.

When you click "OK," all repeated rows are aggregated.

Tables are merged and data is cleaned in the Power Query Editor.

Once you've reviewed the results to confirm that all the data appears as expected, click "Close & Load" in the Home tab.

The top half of the Close and Load button in Power Query Editor is selected.

Now, your beautifully summarized, perfectly spelled data appears in a fresh Excel sheet. Here's a before-and-after screenshot that shows you the benefit of using Power Query's fuzzy matching to merge and clean up messy datasets in Excel.

A side-by-side screenshot of messy data on the left and cleaned, merged, standardized data on the right.

Standard lookups are too rigid for the reality of messy data. By using fuzzy matching, you trade manual data entry for a scalable, automated system that understands intent rather than just syntax. This is just one of many ways to leverage Power Query tools to tidy up messy spreadsheet data—once you get started, you won't be able to stop!

Microsoft 365 Personal.
OS
Windows, macOS, iPhone, iPad, Android
Free trial
1 month

Microsoft 365 includes access to Office apps like Word, Excel, and PowerPoint on up to five devices, 1 TB of OneDrive storage, and more.