3+ Ways to Remove Dashes in Excel

When you are working in Excel, sometimes data have dashes or hyphens(-). Very often, you need to remove those dashes to process data. There are several ways by which you can remove dashes or hyphens(-) from an Excel worksheet. Here, I’m going to show you more than 3 easy methods to remove dashes in Excel.

Here, I will be using a dataset including social security numbers or SSNs as raw data. These numbers have multiple Dashes.

a dataset including social security number

Remove Dashes in Excel Using SUBSTITUTE Function

The easiest and most efficient method to remove dashes in Excel is to use the SUBSTITUTE function.

Syntax

SUBSTITUTE(cell,”old_string”,”new_string”)

Formula

 =SUBSTITUTE(A2,“-”,””)

Formula Explanation

A2 is the cell that contains raw data. Then, “-” is the old_string that you are replacing and “” is the new_string.

To remove dashes in Excel with SUBSTITUTE function, follow these steps below:

  1. Select the top cell of the Result column.
  2. Type the formula: =SUBSTITUTE(A2,“-”,””)
    Remove Dashes in Excel using the SUBSTITUTE Function
    So, this formula will substitute all the dashes(-) of the data of the A2 cell with a null or blank space.
  3. Press ENTER key.
    Applied formula with SUBSTITUTE function in Excel to remove dashes
  4. Now, click on the Fill Handle icon and drag it down to your desired range to fill the rest of the cells of that column.
    Showing output in the first cell after applying formula with SUBSTITUTE function

All the dashes are replaced with null values. Thus, all the unwanted dashes are removed now as you wanted.

Result of Using the SUBSTITUTE function to Remove Dashes in Excel



Remove Dashes Using Find and Replace Command

Find and Replace is one the most common command in Excel. Now, I am going to discuss how you can use it to remove dashes from your data. Here’s how to remove dashes with Find and Replace Command:

  1. Select the whole dataset.
    Raw data to remove dash in Excel
  2. In the Home tab you will find Find & Select. Click on that and choose Replace.
    Find and Select dropdown to choose Replace command in Excel
  3. A pop-up box (Find and Replace) will appear. In the Find what box, put “-”.
  4. In the Replace with box, put nothing. (as we want to remove the dash).
    Remove dashes in Excel using the Find and Replace dialog box
  5. At the bottom left of the box there is Replace All button. Then, press it.

This will remove all the dashes from that column. Basically, it will replace all the dashes with space.

Removed dashes with Find and Replace command

But, you have to keep in mind that this will also remove any zeros that come at first. For example, it will change 006-82-338 to 682338.

Because here, Excel considers the data as numbers. As zeros at first have no significance, it removes them.

Clear Dashes in Excel Using Keyboard Shortcut Key 

You can use a keyboard shortcut for Find and Replace command for more efficiency. To clear dashes in Excel, go through these steps below:

  1. Select the dataset.
  2. Press CTRL + H key. The find and Replace box will open up.
  3. In the Find what box, put “-”.
  4. In the Replace with box, put nothing because we are going to remove dashes.
  5. Press the Replace All button at the bottom left corner of the box.

Use Keyboard Shortcut CTRL+H to open the Find and Replace to Delete Dashes in Excel

The final result with all the dashes removed will look like this.

Removed dashes with keyboard shortcut key in Excel



Remove Dashes in Excel without Removing Zeros with SUBSTITUTE

To remove dashes in Excel without removing the zeros,  you can use a formula using the SUBSTITUTE function. This considers your data as a string instead of a number and keeps the zero as it is.

Syntax

=SUBSTITUE(cell,”old_string”,”new_string”)

Formula

 =SUBSTITUTE(A2,“-”,””)

Formula Explanation

A2 is the cell that contains Raw Data. Then, “-” is the old_string that you are replacing and “” is the new_string.

Steps to remove dashes without removing the zeros:

  1. Type in the top cell of the Result column. =SUBSTITUTE(A2,“-”,””)
    Remove Dashes in Excel without Removing Zeros using the SUBSTITUTE function
  2. Press ENTER key.
  3. Now, click on the Fill Handle icon and drag it down to your desired range to fill the rest of the cells of that column.

All the dashes are replaced with blank spaces. So, all the unwanted dashes are removed now as you wanted.

Using Fill Handle option with SUBSTITUTE function in Excel

How to Remove nth Dash in Excel

Sometimes, you need to remove dashes of nth occurrences. Let’s look at an example. Suppose, your data is 234-56-789 and you want to remove only the second dash keeping the first one as it is. Here the formula I’ve stated above won’t work. Modify it a little bit and you are good to go.

Syntax

=SUBSTITUE(cell,”old_string”,”new_string”,[instance_num])

Formula

=SUBSTITUTE(A2,“-”,””,2) 

Formula Explanation

  • A2 is the cell that contains Raw Data.
  • “-” is the old_string that you are replacing.
  • “” is the new_string.
  • 2 is the instance number. It will indicate the dashes that come in second.

To remove the nth dash in Excel:

  1. Click the top cell of the Result column.
  2. Copy and paste the formula: =SUBSTITUTE(A2,“-”,””,2)
    Remove the nth Dash in Excel using the SUBSTITUTE function
  3. Press ENTER key.
    This formula will substitute all the 2nd dashes from your data with blank spaces.
  4. Now Click on the Fill Handle Icon and drag it down to your desired range to fill the rest of the cells of that column.

Dragged the formula with Fill Handle in Excel

You can see the data without all the dashes in the following image.

Updated result after removing nth dash in Excel

Conclusion

Here, I tried to discuss how can you remove dashes in Excel and pointed out some methods. The methods are both formula-based and command-based. So you can use any of them according to your choice. Hope this article helps you learn to Excel better. Thank you.

Frequently Asked Questions

Why does Excel show dash?

Excel may display a dash for several reasons:

  • Empty Cells or Formulas: If a cell is empty or contains a formula that results in an empty value, Excel may display a dash to signify a null or undefined value.
  • Custom Formatting: The dash (-) is a common placeholder in custom number formats. If you’ve applied a custom format to cells, it might include a dash as a placeholder for zero or null values.
  • Errors or #N/A Values: In some cases, Excel displays a dash to represent errors or #N/A values in cells.

To address this, check the content of the cells, review custom formatting, and resolve any errors or #N/A values in your data. Adjust formatting and content accordingly to ensure accurate representation in Excel.

How do I get rid of dash lines in Excel?

To get rid of dash lines in Excel, you can adjust cell borders. Here’s a concise guide:

  1. Select the cell or range with dash lines.
  2. Right-click and choose Format Cells.
  3. In the Format Cells dialog, go to the Border tab.
  4. Clear or choose a different border style for the affected cells.

This removes dash lines by modifying the cell borders directly. Adjust the steps based on your specific needs or version of Excel.

How do I remove spaces between dashes in Excel?

To remove spaces between dashes in Excel, you can use the SUBSTITUTE function. Here’s a concise formula: =SUBSTITUTE(cell_reference, ” – “, “-“)
Replace “cell_reference” with the reference to the cell containing the text. This formula substitutes occurrences of a space followed by a dash and another space with just a dash, effectively removing the spaces between dashes. Adjust the cell reference as needed for your specific case.

How do I remove everything after a dash in Excel?

To remove everything after a dash in Excel, use the LEFT and FIND functions. Here’s a concise formula: =LEFT(cell_reference, FIND(“-“, cell_reference & “-“) – 1)
Replace “cell_reference” with the reference to the cell containing the text. This formula extracts the text from the beginning of the cell up to the position just before the first dash, effectively removing everything after the dash. Adjust the cell reference as needed for your specific case.

Related Articles

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *