Social security numbers are often written in the format: xxx-xx-xxxx, such as 076-45-1808 (a randomly-generated example).
Several of our customers have asked us how they can remove the hyphens from a SSN.
If you try removing the hyphens manually, something unexpected happens:
As soon as you remove the hyphens, the leading zero disappears. This is because Excel guessed that you were trying to enter the number 76451808 instead of the code 076451808. Excel ignores leading zeros when you enter numbers.
You can solve this problem by using the SUBSTITUTE function.
SUBSTITUTE allows you to substitute any piece of text with any other piece of text. In this case you want to substitute all hyphens in the SSN with a blank space, using a formula like this:
If you’re unfamiliar with Excel formulas and functions, you can find an introduction to them in our completely free Basic Skills course.
The SUBSTITUTE function always returns text (rather than numbers) so it solves the leading zero problem. You can also very easily fill down the formula to remove hyphens from as many numbers as you need.
You can download an example workbook to see this in action.