Excel tutorials

The only Excel books you will ever need

  • The only constantly updated Excel 365 titles more…
  • Thoroughly covers Power Pivot and Power Query more…
  • Covers business intelligence and OLAP features more…
  • Simple, easy, understandable, 2-page lessons more…
  • Available as both printed books and e-Books more…
  • Used by schools, colleges and universities  more…
  • Available for 365, 2019, 2016 and Mac versions more…

Remove dashes from ssn, keep zeros

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.

Alternative Solutions

You could also solve this problem by using Flash Fill, custom formats or Excel’s Find & Replace feature. All of these are covered in depth in our Essential Skills course.

Share this article

Share on facebook
Share on twitter
Share on linkedin
Share on stumbleupon
Share on email

Recent Articles

Wholesale Order Complete

Wholesale Order Complete Thank you for your order We’ll confirm your order and the likely delivery date via e-mail within the next 24 hours. If

Excel protected view warning

Excel protected view: Be careful – files from the Internet can contain viruses. Unless you need to edit it’s safer to stay in Protected View. This article explains what this error message means.

VLOOKUP inexact match illustration (chicken and egg).

VLOOKUP inexact match

VLOOKUP lesson with sample file that will teach you everything there is to know when creating a VLOOKUP inexact match Excel function.

VLOOKUP exact match

Simple VLOOKUP tutorial with sample file that will teach you everything there is to know when creating a VLOOKUP function with an exact match.

4 Responses

    1. Hi Renee, if you have multiple lines of data in a single cell it’s best to break the data into multiple cells before trying to process it further. You can do this with the Text to Columns feature shown in this article.

      1. I have a column with multiple cells. I need to change the entire column from ssn’s with dashes to ssn’s without dashes. This formula is not operating for the entire column

        1. I can’t see any reason why you shouldn’t be able to fill the formula down to apply to as many cells as needed. If you download the example workbook above you should be able to see this in action.

Leave a Reply

Your email address will not be published.

Which tutorial do you need?