logo
search
Formula Errors

How to Compare a Number with a Formatted Account Number in Excel

Huma Ashraf ChHuma Ashraf Ch Sep 27, 2026 869 views

Question details

The user needs to compare a standard 14-digit number with an identically valued text string that contains dashes for formatting (e.g., 17025550100601 vs. 17-02-55-50-1006-01).

How to Compare a Number with a Formatted Account Number in Excel
Product
Excel
Device & OS
not provided
Scenario
Data validation or reconciliation where account numbers from different sources have mismatched formatting.
Observed behavior
Direct cell comparison evaluates to FALSE because one value is numeric and the other is a text string containing dashed separators.
Before you start

Identify which column contains your plain numbers and which contains the dashed account text. Ensure that neither column has hidden leading or trailing spaces by using the TRIM function if necessary.

Solution 1Recommended

Use the SUBSTITUTE Function to Remove Dashes

The most reliable method to compare these values dynamically without permanently altering your original data.

By utilizing the SUBSTITUTE function, you can strip the dashes out of the text string on the fly. Converting the result back into a number allows for a mathematically accurate comparison with the plain numeric value.

1
Select a blank cell

Click on an empty cell where you want the TRUE/FALSE comparison result to appear.

2
Enter the SUBSTITUTE formula

Type the formula =--SUBSTITUTE(C2,"-","")=A2, assuming C2 contains the dashed text and A2 contains the plain number.

3
Evaluate the result

Press Enter. The formula replaces the dashes with nothing, the double negative (--) converts the text to a number, and Excel returns TRUE if it exactly matches the numeric value in A2.

Use the SUBSTITUTE Function to Remove Dashes
Dynamic Updates: This formula will automatically update its result if the account numbers in the referenced cells change.
WPS Spreadsheet Solutions

Easily Compare and Clean Data with WPS Spreadsheet

WPS Spreadsheet provides powerful text functions, formatting tools, and a seamless interface to handle complex data reconciliation tasks like comparing mismatched account numbers effortlessly.

  1. 1. Open your dataset in WPS: Launch WPS Spreadsheet and open the workbook containing your mismatched account numbers.
  2. 2. Apply the comparison formula: Type =--SUBSTITUTE(C2,"-","")=A2 in an adjacent blank column to instantly check for matches.
  3. 3. Drag to fill: Click and drag the fill handle down to apply the comparison logic to your entire dataset.
100% compatible with Microsoft Excel formulas including SUBSTITUTE and TEXTAdvanced Find and Replace tools for rapid data cleaningLightweight application that runs smoothly on any deviceCompletely free built-in templates for financial and accounting tasks
QA img-9

Frequently Asked Questions

Why does Excel say my identical account numbers do not match?

Excel treats numeric values and text strings differently. If one account number is stored as a raw number and the other is a text string containing dashes, a direct cell comparison evaluates to FALSE. You must standardize their formats using formulas before comparing.

What does the double dash (--) do in the SUBSTITUTE formula?

The double negative (or double unary operator) forces Excel to convert a numeric text string into an actual number. Because the SUBSTITUTE function always outputs text, the -- converts that result back to a number so it can properly match your plain numeric account value.

Can I use conditional formatting to highlight mismatched account numbers?

Yes. Select your plain account numbers, go to Home > Conditional Formatting > New Rule, and choose 'Use a formula to determine which cells to format'. Enter a formula like =--SUBSTITUTE(C2,"-","")<>A2 to highlight the rows that do not match.

Will changing the cell format to 'Number' remove the dashes automatically?

No. If the dashes were manually typed into the cell, Excel permanently stores the value as a text string. Changing the cell format only affects how numbers are displayed; it does not remove manual text characters like dashes.