How to Add Dashes to SSN in Excel: 6 Quick Methods

by | Excel

Social Security Numbers (SSNs) are important personal identifiers used in the United States. They typically consist of nine digits and are often presented without dashes.

However, for better readability and organization, it’s best to have dashes, but this can be tricky depending on how many SSNs you have in your data.

Fortunately, it’s a straightforward process.

To add dashes to SSN in Excel:

  1. Select the cells with SSNs.

  2. Go to the “Home” tab in the Excel ribbon.

  3. Find the “Number” group.

  4. Select “Special.”

  5. In the “Format Cells” dialog, choose the “Social Security Number” category.

  6. Click “OK.”

But wait, there’s more! You see, sometimes your dataset can have thousands, or hundreds of thousands, if not millions of SSNs, and then you could need different methods.

Luckily we have 6 great methods to help you out.

Read on.

How to Add Dashes to SSN in Excel

6 Methods to Add Dashes to SSN in Excel

In this section, we will go over 6 methods to add dashes to SSN in Excel.

The 6 methods are:

  1. Using the TEXT Function

  2. Using the CONCATENATE Function

  3. Using Flash Fill

  4. Using Special Format

  5. Using a Custom VBA Function

  6. Using Power Query

6 Methods to Add Dashes to SSN in Excel

Method 1: How to Add Dashes to SSN Using The TEXT Function

To add dashes to SSNs using the TEXT function in Excel, you’ll transform the numeric SSN into the standard SSN format (XXX-XX-XXXX).

Suppose we have the following dataset:

Dataset under analysis

To add dashes to SSN, enter the following formula in a new blank cell:

=TEXT(A2, "000-00-0000")

This formula uses the TEXT function to format the number in A2 as text with the pattern 000-00-0000, where each 0 represents a digit from the SSN.

Writing formula for adding dashes to SSN

Press Enter. Excel will display the SSN with dashes, following the XXX-XX-XXXX format.

Dashes added to SSN

Method 2: How to Add Dashes to SSN Using The CONCATENATE Function

To add dashes to SSNs using the CONCATENATE function in Excel, you can construct a text string that includes the SSN parts separated by dashes.

Enter the following formula in a new cell:

=CONCATENATE(LEFT(A2,3), "-", MID(A2,4,2), "-", RIGHT(A2,4))

LEFT(A2,3) gets the first three characters (or digits) from the SSN. “-“ adds the first dash.

MID(A2,4,2) extracts the two characters starting from the fourth position, giving you the middle segment of the SSN. Another “-” adds the second dash.

RIGHT(A2,4) grabs the last four characters of the SSN.

Writing formula for adding dashes to SSN

Press Enter after typing the formula. Excel will now display the SSN in cell B2 formatted with dashes.

Copy the formula down to other cells by dragging the fill handle downward to cover the range you need.

Dashes added to SSN

Method 3: How to Add Dashes to SSN Using Flash Fill

With Flash Fill, you can easily format data, including adding dashes to SSNs. Flash Fill recognizes patterns in your data entry and automatically fills in the rest of the data for you based on that pattern.

In a new cell, manually enter the SSN with dashes.

For example, if the SSN in A2 is 123456789, you would type 123-45-6789 into B2.

Manually Entering SSN with Dashes

After typing the formatted SSN, select cell B3 or the next cell where you want the pattern to be replicated. Go to the Data tab on the Ribbon, and click on Flash Fill, or simply press Ctrl + E.

Activating the Flash Fill

Excel will quickly add dashes down the rest of the column, applying the same pattern of dashes to the SSNs.

Dashes added to SSN

Method 4: How to Add Dashes to SSN Using Special Format

You can also add dashes to SSN numbers using the special format option in the Number category on the ribbon in Excel.

To do this, select the cells that contain SSNs. Navigate to the Home tab on the left side of your screen and click on the dropdown arrow in the Number tab.

Navigating to Numbers category

A format cells dialog box will open up. In the category, select Special, and then click Social Security Number.

Click OK to apply the changes to the selected cells.

Configuring the dialog box

Excel will automatically format the existing SSNs by adding dashes to it.

Dashes added to SSNs

Method 5: How to Add Dashes to SSN Using a Custom VBA Function

Adding dashes to SNNs using a custom VBA function in Excel allows for more flexibility and automation within your spreadsheets.

This method involves writing a small piece of code to create a function that can be used directly in Excel, similar to built-in functions.

Press Alt + F11 on your keyboard to open the VBA Editor in Excel.

In the VBA Editor, right-click on any of the objects in the Project pane on the left-hand side. Go to Insert > Module to add a new module to your project.

This is where you’ll write your custom function.

Inserting module

In the newly created module, enter the following VBA code:

Function FormatSSN(ssn As String) As String
    ' This function adds dashes to a SSN
    ' Input: "123456789"
    ' Output: "123-45-6789"
    
    If Len(ssn) = 9 Then
        FormatSSN = Left(ssn, 3) & "-" & Mid(ssn, 4, 2) & "-" & Right(ssn, 4)
    Else
        FormatSSN = "Invalid SSN"
    End If
End Function

This function checks if the input string has 9 characters. If so, it formats the SSN by adding dashes. If not, it returns “Invalid SSN”.

In a cell, use the newly created FormatSSN function just like any other Excel function.

Applying the FormatSSN formula

Press Enter, and the cell should now display the SSN with dashes. Using Fill Handle, drag the formula down to apply it to the rest of the column as well.

Dashes added to SSN

Method 6: How to Add Dashes to SSN Using Power Query

Adding dashes to SSNs using Power Query in Excel is a powerful method for cleaning and transforming your data without altering the original dataset.

Start by highlighting the range of cells containing the SSNs. Go to the Data tab on the Ribbon, and click From Table/Range in the Get & Transform Data group.

If your data isn’t already formatted as a table, Excel will prompt you to create a table.

Navigating to Power Query

In the Power Query Editor, go to the Add Column tab. Click on Custom Column.

Adding a custom column

In the custom column formula, you can use a formula like the following:

Text.Start([SSN], 3) & "-" & Text.Middle([SSN], 3, 2) & "-" & Text.End([SSN], 4)

Give your new column a name, such as “Formatted SSN”. After entering the formula and naming the column, click OK.

Writing formula for adding dashes to SSN

After you click OK, Power Query will add a new column that has SSNs with dashes.

Dashes addded to SSNs

Check out our latest clip below to upgrade your data skills.

Final Thoughts

Formatting SSNs with dashes in Excel can help maintain consistency and readability in your data.

Furthermore, learning how to add dashes to SSNs in Excel is just one step in the journey to mastering data management. With this knowledge, you’ll be better equipped to handle and analyze personal information securely and professionally.

Thanks for reading and best of luck with your calculations.

Frequently Asked Questions

In this section, you will find some frequently asked questions you may have when adding dashes to SSNs in Excel.

Data analytics report on a table

How do I convert a Social Security Number to text in Excel?

To convert a Social Security Number (SSN) to text in Excel, you can use the TEXT function.

For example, if the SSN is in cell A1, you can use the formula =TEXT(A1, “000-00-0000”). This will convert the SSN to text with the format 000-00-0000.

What is the formula for displaying dashes in an SSN?

The formula to display dashes in an SSN is =TEXT(SSN_CELL, “000-00-0000”).

Replace SSN_CELL with the reference to the cell containing the SSN you want to format.

How to add dashes to SSN using the replace function?

To add dashes to SSNs using the REPLACE function in Excel, you can replace specific positions in the SSN string with dashes.

For an SSN in cell A1, the formula =REPLACE(REPLACE(A1,6,0,”-“),4,0,”-“) inserts a dash after the third and fifth digits.

This method assumes the SSN is stored as text. If the SSN is numeric, you might first need to convert it to text using the TEXT function, e.g., =TEXT(A1,”000000000″), to ensure proper formatting.

How do I display an SSN with dashes in Excel 2016?

To display an SSN with dashes in Excel 2016, you can use the TEXT function or apply a custom number format.

For the TEXT function, use the formula =TEXT(A1, “000-00-0000”) where A1 is the cell containing the SSN. To apply a custom number format, right-click on the cell, choose Format Cells, select Custom, and enter the format “000-00-0000”.

How do I format a Social Security Number in Excel 2010?

To format a Social Security Number in Microsoft Excel 2010, you can use the TEXT function or apply a custom number format.

The TEXT function has the syntax =TEXT(value, format_text), where you replace value with the cell reference containing the SSN and format_text with the desired format.

For example, =TEXT(A1, “000-00-0000”). To apply a custom number format, right-click on the cell, choose Format Cells, select Custom, and enter the format “000-00-0000”.

Related Posts