Skip to main content
ExcelVLOOKUP with WildcardsLookup & ReferenceCombo RecipeTextPartial MatchWildcard SearchData Analysis

The Problem

Ever found yourself staring at a spreadsheet, desperately needing to find information, but you only have a sliver of the actual data? Perhaps an invoice number with a few missing digits, a customer's name spelled slightly differently in two systems, or a product code where you only recall the beginning or end? This is a universally frustrating scenario that often leads to manual, time-consuming searches and inevitable data entry errors. The standard VLOOKUP function, while powerful, demands an exact match, leaving you stuck when your data isn't perfectly pristine.

What is VLOOKUP with Wildcards? VLOOKUP with Wildcards is an Excel function that allows for partial match lookups by incorporating special characters like the asterisk (*) or question mark (?). It is commonly used to find data even when you only have an incomplete lookup value, such as a partial name, product code, or invoice number, significantly enhancing VLOOKUP's flexibility. Without the ability to perform a partial match lookup, many Excel users find themselves in a bind, unable to extract crucial information from large datasets.

Business Context & Real-World Use Case

Consider a fast-paced sales department trying to track commission payments. A sales manager needs to quickly look up a salesperson's total sales, but the employee names in the CRM system might be "John Smith," while the payroll system has "Smith, John T." or simply "J. Smith." Relying on an exact VLOOKUP here would result in countless #N/A errors, making accurate commission calculations a manual nightmare. In my years as a data analyst, I've seen teams waste hours meticulously cross-referencing lists, leading to delayed reports and even incorrect payouts.

This isn't just a sales problem; it's prevalent across industries. HR departments onboarding new employees might have partial names for background checks, finance teams reconciling bank statements often deal with truncated transaction descriptions, and logistics professionals track inventory with product IDs that vary slightly across suppliers. Automating this partial matching process using VLOOKUP with wildcards provides immense business value. It saves countless hours of manual reconciliation, drastically reduces human error, and ensures that critical business decisions are based on accurate, timely data. This empowers teams to focus on analysis and strategy rather than tedious data cleanup, driving efficiency and profitability.

The Ingredients: Understanding VLOOKUP with Wildcards's Setup

To cook up a VLOOKUP that can handle partial matches, you'll need the standard VLOOKUP syntax, but with a special twist on the lookup_value. The magic truly happens when you incorporate wildcards directly into your search criteria. This technique transforms a rigid lookup into a flexible, intelligent data retrieval tool.

The standard VLOOKUP syntax remains the same:

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Here’s a breakdown of each parameter, with a focus on how lookup_value changes with wildcards:

Parameter Description Example
lookup_value This is the value you want to search for. For partial matches, you concatenate specific wildcard characters (* for any sequence of characters, ? for any single character) directly into this value, typically using the ampersand (&) operator or directly in quotes. This is where the power of VLOOKUP with wildcards truly shines. "*Smith*" to find anything containing "Smith", "Prod???-ABC" to find a specific pattern like "Prod123-ABC".
table_array The range of cells that contains the data you want to search. Crucially, the lookup_value must always be in the first (leftmost) column of this range. If it isn't, VLOOKUP cannot find a match, regardless of wildcards. A2:D100
col_index_num The column number within the table_array from which to retrieve the result. The first column in table_array is 1, the second is 2, and so on. This number determines which piece of information VLOOKUP will return once it finds a match. 3 (to return a value from the third column of the table_array)
[range_lookup] A logical value that specifies whether you want VLOOKUP to find an approximate or exact match. For VLOOKUP with wildcards, you must use FALSE (or 0) to ensure an exact match with the wildcard pattern. Using TRUE (or 1) can lead to incorrect or unexpected results when working with text and wildcards. FALSE (or 0)

Understanding the proper use of these wildcards within your lookup_value is the key to unlocking the full potential of VLOOKUP for flexible text searches.

The Recipe: Step-by-Step Instructions

Let's whip up a practical example. Imagine you have a list of employee names and their salaries, but you often need to look up a salary when you only remember part of their name or their full name isn't consistently entered. This is a perfect scenario for VLOOKUP with wildcards.

Our Goal: Find the salary of any employee whose name contains "Smith" or "Doe".

Sample Employee Data (Sheet1: EmployeeData)

Employee ID Full Name Department Salary
EMP001 John Smith Sales $65,000
EMP002 Jane Doe Marketing $72,000
EMP003 Robert Johnson IT $80,000
EMP004 Emily Smith-Jones HR $70,000
EMP005 David Anderson Finance $90,000
EMP006 Clara D'Oeuvres Operations $68,000
EMP007 Michael Smitherton Sales $75,000

Now, let's create a new sheet or area where we want to perform our lookups:

Lookup Table (Sheet2: SalaryLookup)

Partial Name Search Found Salary
Smith
Doe
Robert
D'O

Here's how to use VLOOKUP with wildcards to get those salaries:

  1. Select Your Target Cell: In Sheet2, click on cell B2 where you want the first salary result to appear. This is where your formula will reside.

  2. Define Your Wildcard Strategy: To find any name containing "Smith," we need to enclose "Smith" with asterisks. If "Smith" is in cell A2, the lookup_value becomes "*" & A2 & "*" or "*" & "Smith" & "*". This tells VLOOKUP to look for "Smith" anywhere within the target cell.

  3. Enter the VLOOKUP Formula: Type the following formula into cell B2:

    =VLOOKUP("*"&A2&"*", Sheet1!B:D, 3, FALSE)
    

    Let's break this down:
    *   `"*"&A2&"*"`: This constructs our wildcard `lookup_value`. It takes the text from cell `A2` (which is "Smith"), prepends an asterisk, and appends another asterisk. So, it effectively searches for "*Smith*".
    *   `Sheet1!B:D`: This is our `table_array`. We're looking in columns B through D on `Sheet1`. Note that the `lookup_value` (Full Name) is in the first column of this range (column B).
    *   `3`: This is our `col_index_num`. We want the salary, which is the 3rd column within our `table_array` (`B:D` -> B=1, C=2, D=3).
    *   `FALSE`: This ensures `VLOOKUP` performs an exact match against our wildcard pattern.

4.  **Press Enter and Observe the Result:** After entering the formula in `B2` and pressing Enter, Excel will return `$65,000`. This is the salary for "John Smith," the first match `VLOOKUP` finds containing "Smith." Remember, `VLOOKUP` always returns the *first* match it encounters from the top of the `table_array`.

5.  **Fill Down for Other Lookups:** Drag the fill handle (the small green square at the bottom-right of cell `B2`) down to `B5` to apply the formula to the other partial names.

    *   For `Doe` (in `A3`), the formula `=VLOOKUP("*"&A3&"*", Sheet1!B:D, 3, FALSE)` will return `$72,000` (for "Jane Doe").
    *   For `Robert` (in `A4`), it will return `$80,000` (for "Robert Johnson").
    *   For `D'O` (in `A5`), it will return `$68,000` (for "Clara D'Oeuvres").

This demonstrates the incredible flexibility of `VLOOKUP` with wildcards, allowing you to extract data even when your lookup criteria are incomplete or inconsistently formatted.

## Pro Tips: Level Up Your Skills

Mastering `VLOOKUP` with wildcards involves more than just knowing the syntax; it's about applying best practices that ensure robust and error-free lookups. As an Excel consultant, I always recommend these approaches:

*   **Error Handling with `IFERROR`:** A professional best practice is to wrap your `VLOOKUP` formula in `IFERROR`. Since partial matches can sometimes yield no results or unexpected ones, `IFERROR` prevents unsightly #N/A errors from cluttering your reports. For example: `=IFERROR(VLOOKUP("*"&A2&"*", Sheet1!B:D, 3, FALSE), "Not Found")`. This makes your spreadsheets much cleaner and easier to read.
*   **Strategic Wildcard Placement:** Understand the nuances of wildcard placement.
    *   `"text*"`: Finds values starting with "text" (e.g., "Prod*" finds "Product A", "Production Line").
    *   `"*text"`: Finds values ending with "text" (e.g., "*Report" finds "Sales Report", "Daily Report").
    *   `"*text*"`: Finds values containing "text" anywhere (e.g., "*App*" finds "Apple", "Grape", "Application"). This is the most common use of `VLOOKUP` with wildcards.
    *   `"text???"`: Finds values starting with "text" followed by exactly three characters (e.g., "SKU???" finds "SKU123", "SKUABC").
*   **Case Sensitivity:** By default, `VLOOKUP` is not case-sensitive. "Smith" will match "smith," "SMITH," or "Smith." If you absolutely need case-sensitive partial matching, you'll need to combine `VLOOKUP` with more advanced functions like `INDEX`, `MATCH`, and `FIND`, which goes beyond basic `VLOOKUP` with wildcards. For most business scenarios, the case-insensitivity of `VLOOKUP` is an advantage.
*   **Escaping Wildcards:** What if you actually want to search for an asterisk or question mark character itself? You must "escape" them by preceding them with a tilde (`~`). For example, to search for "Product*," you would use `"Product~*"`. This tells `VLOOKUP` to treat the `*` as a literal character, not a wildcard.

## Troubleshooting: Common Errors & Fixes

Even experienced Excel users can stumble when using `VLOOKUP` with wildcards. Here are some common pitfalls and how to elegantly resolve them, turning frustration into triumph.

### 1. #N/A Error: No Match Found

*   **Symptom:** Your `VLOOKUP` formula returns `#N/A`.
*   **Cause:** This typically means `VLOOKUP` couldn't find any value in the first column of your `table_array` that matches your wildcard `lookup_value`. This is a common mistake we've seen when the data isn't as expected.
*   **Step-by-Step Fix:**
    1.  **Verify Lookup Value:** Double-check the spelling of the partial text you're searching for (e.g., "Smth" instead of "Smith").
    2.  **Confirm Wildcard Placement:** Ensure your asterisks (`*`) or question marks (`?`) are correctly placed. For instance, if you expect "Smith" to be in the middle of a string but use `"Smith*"` (starts with Smith), it won't find "John Smith."
    3.  **Check `table_array`:** Make sure the column containing the values you're trying to match is indeed the *first* column of your `table_array` range. If "Full Name" is in column B, your `table_array` must start at B (e.g., `B:D`), not A (`A:D`).
    4.  **Inspect Data for Hidden Characters:** Sometimes, cells contain leading/trailing spaces or non-printable characters that prevent a match. Use `TRIM()` on your data or within your lookup value (e.g., `"*"`&`TRIM(A2)`&`"*"`) to clean these up.

### 2. Incorrect Column Index (#VALUE! or Wrong Data)

*   **Symptom:** You either get a `#VALUE!` error, or `VLOOKUP` returns a value from an unexpected column, which is worse because it looks like a correct result!
*   **Cause:** The `col_index_num` parameter is incorrect. Either it refers to a column number outside the `table_array` (causing `#VALUE!`) or it points to the wrong column, giving you valid but incorrect data.
*   **Step-by-Step Fix:**
    1.  **Count Carefully:** Mentally (or physically) count the columns within your `table_array` range. If your `table_array` is `B:D`, then B is column 1, C is column 2, and D is column 3. Make sure your `col_index_num` matches the relative position of the desired return column within *that specific range*.
    2.  **Adjust `table_array`:** If you add or remove columns in your source data, remember to update both your `table_array` and your `col_index_num`. A better practice for flexible column indexing is to use `MATCH` in conjunction with `VLOOKUP`, but that's a more advanced recipe.

### 3. Misunderstood Wildcard Behavior (Literal Search for * or ?)

*   **Symptom:** Your formula returns `#N/A` even when you're sure the `*` or `?` character is present in your data, or it returns unexpected results.
*   **Cause:** You're trying to literally search for an asterisk (`*`) or question mark (`?`) character in your data, but Excel is interpreting them as wildcards. This happens when the data itself contains these special characters.
*   **Step-by-Step Fix:**
    1.  **Escape Wildcards:** To search for a literal asterisk or question mark, you must precede it with a tilde (`~`). For example, if you want to find "Product*123", your `lookup_value` should be `"*Product~*123*"`.
    2.  **Distinguish `*` vs. `?`:** Remember `*` matches any sequence of zero or more characters. `?` matches exactly one character. Confusing these two will lead to missed matches. For instance, `"ABCD?"` will match "ABCDE" but not "ABCD" or "ABCDEF".

Addressing these common issues will significantly improve your proficiency with `VLOOKUP` with wildcards and make your Excel experience much smoother.

## Quick Reference

*   **Syntax:** `VLOOKUP(lookup_value, table_array, col_index_num, FALSE)`
    *   `lookup_value`: Text string with `*` (any characters) or `?` (single character) wildcards. Concatenate using `&` (e.g., `"*Text*"`, `"Text*"&A1&"*"`).
    *   `table_array`: Range where the first column contains the `lookup_value`.
    *   `col_index_num`: Column number in `table_array` to return the result from.
    *   `FALSE`: Essential for exact matching of the wildcard pattern.
*   **Most Common Use Case:** Performing partial text searches for names, product codes, invoice numbers, or any textual data where you only have an incomplete string, especially when data entry might be inconsistent.

## Related Functions

*   [Mastering VLOOKUP](/recipes/vlookup)
*   [Exploring XLOOKUP](/recipes/xlookup)
*   [Unlocking INDEX MATCH](/recipes/index-match)
👨‍💻

Written by The Head Chef

Former 10-year Financial Analyst who survived countless month-end closes. I build these recipes to save you from weekend-ruining spreadsheet errors.

Read the full story →

You might also find these useful 💡