Fuzzy Match in Excel: Find Names That Nearly Match
By ExcelReady TeamUpdated 6 min read
The short answer
Excel has no fuzzy match function, so you combine three tools. Clean both lists with TRIM and SUBSTITUTE, then look up partial names with a wildcard: =XLOOKUP(""&E2&"",A2:A6,B2:B6,"Not found",2). For real typos, like Contosso for Contoso, use Power Query's Merge with "Use fuzzy matching". Always review fuzzy results before you trust them.
Key takeaways
- Most "near matches" are really spaces, punctuation or extra words. Clean them and an exact match works.
- XLOOKUP with match mode 2 and ""&E2&"" finds a name that contains your text.
- Use XLOOKUP(TRUE,ISNUMBER(SEARCH(...))) when the short name is in the table and the long name is in your cell.
- Formulas can't fix spelling mistakes. Power Query's fuzzy merge can, with a similarity threshold.
- Check how many rows a wildcard matches with COUNTIF, because XLOOKUP returns only the first.
On this page+
A fuzzy match in Excel finds names that are close but not identical, like "Fabrikam, Inc" and "Fabrikam Inc.". Excel has no single fuzzy-match function, but most near matches are really extra spaces, punctuation or extra words, and TRIM, SUBSTITUTE and wildcard lookups handle those. For true spelling mistakes, Power Query has a fuzzy merge. This guide shows each method, from simplest to strongest, so you can match customer, supplier or employee lists that don't line up.
What "fuzzy matching" means#
Fuzzy matching means finding the best match even when two text values aren't exactly the same. A normal lookup like XLOOKUP or VLOOKUP with an exact match fails on any difference at all and returns #N/A. Here are the usual differences and what fixes them:
| Difference | Example | Fix |
|---|---|---|
| Extra spaces | " northwind " vs Northwind Traders | TRIM plus a wildcard |
| Capital letters | ADVENTURE WORKS | Nothing: lookups ignore case |
| Punctuation | Fabrikam, Inc vs Fabrikam Inc. | SUBSTITUTE |
| Extra words | Tailspin vs Tailspin Toys | Wildcard lookup |
| Spelling mistake | Contosso vs Contoso Ltd. | Power Query fuzzy merge |
All the examples use this supplier list in A1:B6:
| A | B | |
|---|---|---|
| 1 | Supplier | Account manager |
| 2 | Contoso Ltd. | Priya |
| 3 | Fabrikam Inc. | Tom |
| 4 | Northwind Traders | Lena |
| 5 | Adventure Works Cycles | Omar |
| 6 | Tailspin Toys | Mei |
Step 1: clean the text first#
Cleaning removes the differences that don't matter, so more names match exactly. TRIM deletes spaces at the start and end and squeezes double spaces to one. SUBSTITUTE removes characters you don't care about, like commas and full stops:
=TRIM(SUBSTITUTE(SUBSTITUTE(E2,",",""),".",""))This turns Fabrikam, Inc. into Fabrikam Inc. Clean both lists the same way, in helper columns, and many "fuzzy" problems simply disappear. If TRIM seems to do nothing, the data may contain non-breaking spaces from a web page; the guide on why TRIM isn't working shows the fix. You can practise cleaning text in a live sheet, and the TRIM function guide has the syntax.
Step 2: find partial matches with XLOOKUP wildcards#
When the typed name is part of the full name, wrap it in wildcards. In Excel, * means "any number of characters", so "*northwind*" matches anything that contains northwind. XLOOKUP uses wildcards only when you set its fifth argument, the match mode, to 2:
=XLOOKUP("*"&TRIM(E2)&"*",A2:A6,B2:B6,"Not found",2)If E2 holds " northwind ", TRIM gives northwind, the pattern becomes *northwind*, and the result is Lena. Case doesn't matter, so ADVENTURE WORKS returns Omar. XLOOKUP needs Excel 2021 or Microsoft 365. See the XLOOKUP function guide and the article on XLOOKUP wildcard matches for more patterns.
In older Excel, VLOOKUP accepts wildcards whenever the last argument is FALSE:
=VLOOKUP("*"&TRIM(E2)&"*",A2:B6,2,FALSE)The guide to VLOOKUP with wildcards covers that version. To search for a real * or ? character, put a tilde in front of it: ~*.
Check for more than one match#
A wildcard can match several rows, and XLOOKUP silently returns the first. Before you trust a result, count the candidates:
=COUNTIF(A2:A6,"*"&TRIM(E2)&"*")A result of 1 is safe. A result above 1 means the search text is too short; "*Works*" might match both "Adventure Works Cycles" and another supplier with "Works" in its name. The wildcards in criteria lesson practises these patterns.
Step 3: when the long name is in your cell#
Sometimes it's the other way round: the table holds short names like Fabrikam, and your cell holds a long one like FABRIKAM INC. (UK). A wildcard around the cell won't help, because the long text isn't inside the short one. Instead, ask SEARCH whether each table name appears inside your cell:
=XLOOKUP(TRUE,ISNUMBER(SEARCH(A2:A6,E2)),B2:B6,"Not found")SEARCH returns a position number where it finds a table name inside E2, and an error where it doesn't. ISNUMBER turns that into TRUE or FALSE, and XLOOKUP returns the row of the first TRUE. With Fabrikam in the table, the result is Tom. SEARCH ignores case; the SEARCH function guide explains the details.
Step 4: fix typos with Power Query fuzzy merge#
Formulas can't tell that "Contosso" is a misspelling of "Contoso". Power Query, the data tool built into Excel, can. Its Merge Queries command has a fuzzy matching option in Excel for Microsoft 365 on Windows; the Mac and web versions have fewer Power Query features.
- Turn each list into a table (Ctrl+T), then load each one with Data > From Table/Range.
- In the Power Query editor, choose Home > Merge Queries.
- Pick the second table and click the name column in both.
- Tick Use fuzzy matching to perform the merge.
- Open Fuzzy matching options and set the Similarity threshold, a number from 0 to 1. Higher is stricter.
- Click OK, expand the new column, and choose Close & Load.
Fuzzy matching makes guesses, so some will be wrong. Start strict, lower the threshold slowly, and review every match before you use it. Microsoft has also published a Fuzzy Lookup add-in for Windows desktop Excel that works in a similar way.
Which method should you use?#
Start simple and only move on when the simpler method leaves gaps:
| Your problem | Best method | Works in |
|---|---|---|
| Spaces, case, punctuation | TRIM and SUBSTITUTE, then exact match | Every version |
| Typed name is part of the full name | XLOOKUP or VLOOKUP with wildcards | XLOOKUP: 2021 and 365; VLOOKUP: all |
| Full name contains the table name | XLOOKUP + ISNUMBER + SEARCH | Excel 2021 and 365 |
| Spelling mistakes | Power Query fuzzy merge | Microsoft 365 (Windows) |
If you're matching numbers rather than text, you want the nearest value instead; see how to find the closest match in Excel. And if a lookup still shows #N/A, the guide to fixing the #N/A error walks through every cause.
Practise it#
Wildcard lookups are a favourite in data-cleaning tests. Practise XLOOKUP wildcards and match modes in a live spreadsheet: you search partial names and set the match mode yourself, and each formula is checked instantly. Then try wildcards in criteria and the cleaning text lesson, and do the exercise on this page.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Someone typed a supplier name with extra spaces in E2. In F2, use XLOOKUP to find the account manager: search for *""&TRIM(E2)&""* in A2:A6, return B2:B6, use "Not found" if there's no match, and set match mode 2 (wildcards).
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Account manager | Manager | |||||
| 2 | Priya | northwind | |||||
| 3 | Tom | ||||||
| 4 | Lena | ||||||
| 5 | Omar | ||||||
| 6 | Mei | ||||||
| 7 | |||||||
| 8 | |||||||
| 9 |
Tip: Build the pattern first: "*"&TRIM(E2)&"*". Match mode 2 is the fifth argument.
Practise this in a lesson
Frequently asked questions
Does Excel have a fuzzy lookup function?
No worksheet function does fuzzy matching. You can get close with TRIM, SUBSTITUTE and wildcard lookups, and Power Query's Merge Queries has a Use fuzzy matching option for spelling differences.
How do I match partial text in Excel?
Put wildcards around the text and use an exact-match lookup: =XLOOKUP(""&E2&"",A2:A6,B2:B6,"Not found",2), or =VLOOKUP(""&E2&"",A2:B6,2,FALSE) in older Excel.
How do I compare two lists of names that are not exactly the same?
Clean both lists first with TRIM, LOWER and SUBSTITUTE to remove spaces, case and punctuation. Then use XLOOKUP or COUNTIF. Whatever still fails to match usually needs a fuzzy merge in Power Query or a manual check.
What is the similarity threshold in Power Query fuzzy matching?
It is a number from 0 to 1 that sets how alike two values must be to match. Higher values are stricter. Start with the default and lower it slowly while checking the results.
Why does my wildcard lookup return the wrong row?
A wildcard can match several rows, and XLOOKUP returns the first one it finds. Use COUNTIF with the same pattern to see how many rows match, and make the search text more specific.