Function Problems

Fix XLOOKUP Not Working After Removing Hyphens with SUBSTITUTE

Phi Hung VoPhi Hung Vo Oct 14, 2026 868 views

Question details

The user is trying to combine XLOOKUP and SUBSTITUTE to match data by removing hyphens, but the function does not return the expected results.

Fix XLOOKUP Not Working After Removing Hyphens with SUBSTITUTE
Product
Spreadsheet
Device & OS
not provided
Scenario
Looking up values across datasets where one or both lists contain hyphens that need to be ignored during the match.
Observed behavior
XLOOKUP fails to find a valid match and returns an error or a 'Not found' result despite the hyphens being removed via the SUBSTITUTE function.
Before you start

Verify that your dataset does not contain hidden trailing or leading spaces that might cause the lookup to fail even after the hyphens are removed.

Solution 1Recommended

Normalize Both Lookup Value and Lookup Array in the Formula

Use this solution to ensure that the hyphens are removed from both the search value and the search range simultaneously, creating a perfect match.

A common reason for XLOOKUP to fail is that only the lookup value is stripped of hyphens, while the array being searched still contains them. Normalizing both sides using nested SUBSTITUTE functions solves this.

1
Select the Destination Cell

Click on the cell where you want the XLOOKUP result to appear.

2
Enter the Nested XLOOKUP Formula

Type the formula: =XLOOKUP(SUBSTITUTE(E2,"-",""), SUBSTITUTE(A2:A100,"-",""), B2:B100, "Not found").

3
Execute the Formula

Press Enter to apply the formula. XLOOKUP will natively process the array and return the matching value.

Normalize Both Lookup Value and Lookup Array in the Formula
Match Success: By applying SUBSTITUTE to both arguments, you guarantee that Excel compares the exact same text format.
Advanced Spreadsheet Functions

Solve Complex Lookups Easily with WPS Spreadsheet

WPS Spreadsheet fully supports advanced dynamic array functions like XLOOKUP and SUBSTITUTE, making data cleaning and lookup tasks straightforward. You can use advanced formulas seamlessly.

  1. 1. Open Your Data: Launch WPS Spreadsheet and open the workbook containing your lookup data.
  2. 2. Select Formula Cell: Click the specific cell where you want the XLOOKUP results displayed.
  3. 3. Input the Formula: Type the combined formula =XLOOKUP(SUBSTITUTE(E2,"-",""), SUBSTITUTE(A2:A100,"-",""), B2:B100) and press Enter.
  4. 4. Enjoy Instant Results: WPS Spreadsheet effortlessly processes the dynamic array calculations to match your normalized data.
Fully supports advanced dynamic array functions like XLOOKUP100% compatible with Microsoft Excel formulas and file formatsBuilt-in robust data cleaning and formatting toolsFree and lightweight alternative to heavy office suites
microsoft office alternative - wps office

Frequently Asked Questions

Why does SUBSTITUTE change my number format into text?

The SUBSTITUTE function is explicitly designed to manipulate strings. Even if it operates on numbers and outputs numerical digits, the output type is treated as text. This can cause lookup mismatches if you are comparing it against actual numbers unless you use operations like '+0' to convert it back.

Can I use nested SUBSTITUTE functions to remove multiple different characters?

Yes, you can nest the SUBSTITUTE function within itself to strip multiple specific characters simultaneously. For example, =SUBSTITUTE(SUBSTITUTE(A1, "-", ""), " ", "") will remove both hyphens and spaces from the cell data.

Does XLOOKUP natively support dynamic array manipulations like SUBSTITUTE?

Yes, unlike older functions like VLOOKUP, XLOOKUP is built to process dynamic arrays directly. This means you can manipulate an entire range of data using SUBSTITUTE inside the XLOOKUP formula without strictly needing a helper column.