Microsoft Excel offers multiple ways to add dashes to social security numbers (SSNs), including using formulas or the Format Cells dialog box. In this article, we will demonstrate 6 methods to add dashes to an SSN in Excel with ease.
Method 1 – Using the TEXT Function to Add Dashes to SSNs
We can add dashes to social security numbers (SSN) using the TEXT function.
Steps:
- Select cell D5.
- Insert the following formula:
=TEXT(B5,"???-??-????")
Here, B5 refers to an SSN without any dashes.
- Press ENTER to execute the formula.
- Move the mouse cursor to the right-bottom corner of cell D5.
A plus (+) icon called the Fill Handle will appear.
- Drag the Fill Handle down to cell D14.
All the social security numbers have dashes.
Method 2 – Combining the LEFT, MID and RIGHT Functions to Add Dashes to SSNs
We can combine the LEFT, MID, and RIGHT functions to create a formula to add dashes to an SSN in Excel.
Steps:
- Select cell D5.
- Insert the following formula then press ENTER:
=LEFT(B5,3)&"-"&MID(B5,4,2)&"-"&RIGHT(B5,4)
In this formula:
- LEFT(B5,3) extracts 3 digits from the left side of an SSN.
- MID(B5,4,2) extracts 2 digits starting from the 4th digit of an SSN.
- RIGHT(B5,4) extracts the last 4 digits from the right side of an SSN.
- LEFT(B5,3)&”-“&MID(B5,4,2)&”-“&RIGHT(B5,4) inserts dashes (-) after the 3rd and 5th digit of an SSN
- Drag the Fill Handle icon from cell D5 to cell D14.
All the SSNs have dashes.
Method 3 – Using the REPLACE Function to Add Dashes to SSNs
Making use of the REPLACE function is another option to add dashes to social security numbers in Excel.
Steps:
- Select cell D5.
- Insert the following formula then press ENTER:
=REPLACE(REPLACE(B5, 4, 0, "-"), 7, 0, "-")
Here,
- REPLACE(B5, 4, 0, “-“) introduces a dash (-) at the 4th position of the SSN number in cell B5.
- REPLACE(REPLACE(B5, 4, 0, “-“), 7, 0, “-“) inserts another dash (-) at the 7th position of that SSN number.
- Drag the Fill Handle icon from cell D5 to cell D14.
All the social security numbers have dashes.
Method 4 – Using Special Number Formatting to Add Dashes to SSNs
Steps:
- Select all the SSN numbers.
- Press CTRL + 1 to open the Format Cells dialog box.
- Go to the Number tab.
- Select Special from the Category list.
- Choose Social Security Number from the Type section.
- Click OK to apply the changes.
All the selected SSNs have dashes.
Method 5 – Using Custom Number Formatting to Add Dashes to SSNs
Another way to add dashes to an SSN is by applying a Custom number format from the Format Cells dialog box.
Steps:
- Select all the SSNs.
- Press CTRL + 1 to open the Format Cells dialog box.
- Navigate to the Number tab.
- Choose Custom from the Category list.
- Into the Type box, insert the following formula:
000-00-0000
- Click OK.
All the SSNs have dashes, set automatically by the number format.
Method 6 – Using Flash Fill to Add Dashes to SSNs
Flash Fill is a powerful feature included in Microsoft Excel 2019 and later versions, which can be used to add dashes to all the SSNs in Excel.
Steps:
- Create another column adjacent to the column having SSNs without dashes.
- In the top cell of the new column, copy the undashed value from the cell to the left and insert dashes to the SSN manually.
- Select the whole column.
- Go to Home > Editing > Fill > Flash Fill.
Excel will extract the pattern from the cell, and insert dashes to all the other SSNs accordingly, as in the following screenshot:
Things to Remember
- Flash Fill is only available in Excel 2019 and Microsoft Office 365.
- The Flash Fill feature doesn’t support Automatic Updates.
Download Practice Workbook
You can download the Excel file from the following link and practice along with it.
Related Article
<< Go Back to Excel TEXT Function | Excel Functions | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!