Managing inventory or procurement databases often leads to frustration when trying to compare inconsistent part numbers containing minor wildcard variances. While standard reconciliation tools like exact-match VLOOKUP offer a basic starting point, they inevitably fail when faced with format shifts, forcing tedious manual audits. Mastering wildcard-enabled formulas grants you the ability to automate these validation checks with absolute precision. However, this approach carries the stipulation that characters like * or ? must be structured carefully to prevent false positives-such as incorrectly matching "A-12*" with "A-12345". Below, we outline the exact formulas to streamline your data matching.
Managing inventory, supply chains, or manufacturing databases often requires comparing part numbers across different systems. However, part numbers are rarely standardized across vendors, distributors, or internal legacy databases. One system might list a component as 901-554-A, another as 901554A, and a third as 901-554* (where the asterisk represents any sub-variant or revision code).
When dealing with thousands of rows of data, manual reconciliation is out of the question. To solve this, Excel formulas can be deployed to dynamically compare part numbers that contain wildcard variances. By mastering wildcards like the asterisk (*) and question mark (?), combined with robust lookup functions like XLOOKUP, INDEX/MATCH, and text sanitation functions, you can automate this auditing process with near-perfect accuracy.
Before diving into complex formulas, it is essential to understand the tools Excel provides for partial matching. Excel supports three native wildcard characters in many of its search and lookup functions:
*): Represents any number of characters. For example, "AB*" will match "AB", "ABC", "AB-123", or "AB-XYZ".?): Represents exactly one single character. For example, "AB-???" will match "AB-123" or "AB-XYZ", but will not match "AB-12" or "AB-1234".~): Escape character. If your part numbers actually contain a literal asterisk or question mark, you can search for them by placing a tilde before them (e.g., "AB~*" matches "AB*").If you have a master list of approved part patterns (which include wildcards) and you want to verify if a specific, concrete part number fits into one of those patterns, you can use the COUNTIF or COUNTIFS function.
Consider the following lookup table of master pattern rules:
| Master Pattern (Column A) | Description |
|---|---|
RES-10K-* |
Any 10k Resistor variant |
CAP-???-50V |
Any Capacitor with a 3-character value code rated at 50V |
If you have a list of incoming inventory part numbers in Column D (e.g., RES-10K-0805), you can check if it matches your master patterns using this formula in cell E2:
=COUNTIF(A:A, D2) > 0
How it works: The COUNTIF function naturally interprets the wildcards present inside your Master Pattern list. It checks the criteria in Column A against the value in D2. If it finds a match (returning a count of 1 or more), the formula evaluates to TRUE; otherwise, it returns FALSE.
Sometimes, "wildcard" variances are not actually wildcard symbols but are instead structural discrepancies-such as dashes, spaces, or slashes. For instance, comparing MKT-456-B with MKT456B.
To perform a clean comparison, you should strip out these structural variances on-the-fly using the SUBSTITUTE function before executing the match. The following array formula compares two columns of part numbers while ignoring dashes and spaces:
=SUBSTITUTE(SUBSTITUTE(A2, "-", ""), " ", "") = SUBSTITUTE(SUBSTITUTE(B2, "-", ""), " ", "")
By nesting multiple SUBSTITUTE functions, you normalize both strings to a pure alphanumeric format, ensuring that minor stylistic differences do not flag the records as mismatched.
For modern Excel users, the XLOOKUP function offers a built-in parameter designed explicitly for handling wildcard matching. This is highly beneficial when you need to match a partial part number in your search and extract a corresponding value (like unit price or inventory location) from a master table.
Suppose you are searching for a part number where you only know the core series sequence, such as "8902-*", and want to find its storage bin in a master list.
| Part Number (A) | Storage Bin (B) |
|---|---|
8902-A-99 |
Bin 14 |
7441-B-02 |
Bin 09 |
To pull the storage bin for the wildcard query, construct your XLOOKUP formula as follows:
=XLOOKUP("8902-*", A2:A3, B2:B3, "Not Found", 2)
Crucial Parameter: The fifth argument in this formula is set to 2. This instructs Excel to perform a "Wildcard character match." If this argument is omitted, XLOOKUP will look for a literal string containing an asterisk rather than treating it as a dynamic wildcard pattern.
A more complex scenario arises when your lookup value is concrete (e.g., "IC-555-DIP") but your master lookup table contains wildcard rules (e.g., "IC-555-*"). Standard VLOOKUP or XLOOKUP with a wildcard match mode of 2 will fail here because Excel expects the wildcard characters to reside inside the lookup value parameter, not the lookup array.
To overcome this limitation, you can utilize a combination of SUMPRODUCT, ISNUMBER, and SEARCH. Let's say your concrete part number is in cell D2, and your master list of wildcard rules is in A2:A10.
Use the following formula to find if a match exists:
=SUMPRODUCT(--ISNUMBER(SEARCH(A$2:A$10, D2))) > 0
Detailed breakdown:
SEARCH(A$2:A$10, D2): This searches for each pattern pattern inside cell D2. If a pattern matches, it returns a starting character position (a number). If it doesn't match, it returns a #VALUE! error. Note that SEARCH natively supports wildcard characters within its query.ISNUMBER(...): Converts numbers to TRUE and errors to FALSE.-- (Double Unary Operator): Coerces TRUE/FALSE values into 1 and 0.SUMPRODUCT(...): Sums up the array. If the sum is greater than 0, it means at least one matching wildcard rule was successfully found in the master list.When working with large datasets of over 10,000 part records, wildcard matching formulas can put a strain on Excel's calculation engine. Keep these performance optimization tips in mind:
SEARCH is case-insensitive, functions like FIND are case-sensitive. When comparing part numbers, stick to SEARCH or convert your comparisons to uppercase using the UPPER function.A:A) inside array formulas or SUMPRODUCT forces Excel to calculate millions of cells, causing severe lag. Instead, define exact ranges (e.g., A2:A1000) or convert your data into Excel Tables (Ctrl + T) to use clean structured references.TRIM and CLEAN to remove invisible whitespace or non-printable characters that might creep in during system exports, as these characters will prevent wildcards from resolving accurately.Reconciling disparate part numbers does not have to be a tedious, manual chore. By understanding how Excel processes wildcards and structural variations, you can build smart, self-healing spreadsheets. Whether utilizing simple COUNTIF statements to flag incoming discrepancies or employing advanced XLOOKUP and SUMPRODUCT operations to bypass traditional lookup constraints, these formula structures will ensure your data auditing remains seamless, efficient, and robust.
Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.