How to Add Dashes into Numeric String/Phone Number/SSN in Excel

Suppose we have a list of numbers and we want to separate them into different parts by dash, how can we quickly add dashes into the numeric string? This article will provide you two ways to add dashes, one is to add dash by formula, the other one is set number format by custom in format cells. We also provide the method to add dashes for Phone Number and SSN.

Add Dashes into Numeric String 1

In above table, change 20200301 in A1 to 2020-03-01 in C1, we need to add two dashes to separate the string, though we can add dash manually one by one, it is still a little complex for users. So, we need a simple way to add dashes now.

Method 1: Add Dashes by Formula


Step 1: In C1, enter the formula =TEXT(A1,”????-??-??”). In this formula, ????-??-?? is the final format of string.

Add Dashes into Numeric String 2

Step 2: Click Enter to get result. Verify that numeric string is displayed into three parts and connected by dash properly.

Add Dashes into Numeric String 3

Step 3: Drag the fill handle to fill C2 to C6. Verify that all numeric strings are add separated by dashes properly.

Add Dashes into Numeric String 4

Note:

1.You can set format_text parameter depends on your demand. For example, in this case if you enter =TEXT(A1,”??-??-??-??”), then numeric string 20200301 will be displayed as 20-20-03-01 finally.

Add Dashes into Numeric String 5

2.You can use other formula to set format for string. For example, enter formula =LEFT(A1,4)&”-“&MID(A1,5,2)&”-“&RIGHT(A1,2). Then you can get the same result.

Add Dashes into Numeric String 6

Add Dashes into Numeric String 7

Method 2: Add Dashes by Set Format as Custom in Format Cell


Step 1: Copy A column to C column.

Add Dashes into Numeric String 8

Step 2: Select C2:C6, then right click to load menu, select Format Cell.

Add Dashes into Numeric String 9

Step 3: In Format Cell, under Number tab, select Custom from Category list. Then in Type textbox, enter 0000-00-00. Then after typing the Type, in Sample field, 2020-03-01 is displayed. Then click OK.

Add Dashes into Numeric String 10

Step 4: Verify that dashes are added into string as we expect.

Add Dashes into Numeric String 11

Method 3: Add Dashes by Set Format as Special in Format Cell


If we want to add dashes into number with fixed format like Phone Number or SSN, you can directly select Special->Type->Phone Number (or Social Security Number) in Format Cells, see screenshot below.

Screenshot 1: Set number to Phone Number.

Add Dashes into Numeric String 12

Screenshot 2: Set number to Social Security Number.

Add Dashes into Numeric String 13

 

Related Posts

Extract Unique Items From A List
Extract Unique Items From A List In Excel1

This post will guide you how to extract unique itmes from a given list in Microsoft Excel. How to create a newly formula to get unique values from a range cells in Excel. The unique list of items is the ...

Extract substring In Excel
Extract substring In Excel1

This post will guide you how to use Excel's MID function is a quick and easy way to extract pieces from your text. Use the Excel formula to extract a substring with MID. Note: If you want to extract just ...

How to Use 3D SUM Multiple Worksheets
3D sum multiple worksheets1

To sum a range of numbers is straightforward for most Excel users, but do you know how to establish a 3D reference to total the same range of numerous sheets. In this post, I will present the steps for this ...

Extract all the matches with helper Column
how to extract all matches with helper column1

With Excel's powerful functions IF, INDEX, and MATCH, we can find exactly what you're looking for with a few clicks of the mouse. This step-by-step tutorial will show how easy it is to extract data using these tools and more! ...

If Cell is This Value or That Value

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of logical test. If you want to see if a cell is A or B, and if one of ...

If Value is Greater Than A Certain Value
If Value is Greater Than A Certain Value 1

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the logical test result. If you want to see if a value in one cell is greater than a specific value, ...

If Cell is Not Blank
If Cell is Not Blank 6

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if a cell is blank or not, and leave some ...

VBA Macro For VLOOKUP From Another Sheet
vba macro for vlookup from another sheet1

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you how to use VBA code to vlookup data ...

If Cell is Blank
If Cell is Blank_1

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if a cell is blank or not, and leave some ...

If Cell Equals Certain Text String
If cell equals certain text_1

IF function is frequently used in Excel worksheet to return you expect “true value” or “false value” based on the result of created logical test. If you want to see if cell equals a certain text string like “Win”, you ...

Sidebar