How to remove dashes in excel
Tutor 5 (273 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To remove dashes in Excel, follow these methods depending on your needs:
1. Using Find and Replace
-
Select the cells where you want to remove dashes.
-
Press Ctrl + H (Windows) or Command + Shift + H (Mac) to open the Find and Replace dialog box.
-
In the Find what field, type
-. -
Leave the Replace with field empty.
-
Click Replace All.
This method instantly removes all dashes from the selected cells.
2. Using the SUBSTITUTE Function
-
Suppose cell
A1contains a value with dashes, e.g.,123-45-6789. -
Enter the following formula in another cell:
-
Press Enter.
This formula creates a new value without dashes. Drag the formula down to apply it to multiple rows.
3. Using Flash Fill
-
Type the value without dashes in a column next to your data. For example, if
123-45-6789is inA1, type123456789inB1. -
Go to the next cell in the column (
B2) and start typing the corrected value. -
Excel will automatically suggest a pattern. Press Enter to apply the Flash Fill for all remaining cells.
-
You can also use Ctrl + E to trigger Flash Fill.
4. Using VBA (Macro) for Large Datasets
-
Press Alt + F11 to open the VBA editor.
-
Go to Insert → Module and paste this code:
Sub RemoveDashes()
Dim cell As Range
For Each cell In Selection
If Not IsEmpty(cell) Then
cell.Value = Replace(cell.Value, "-", "")
End If
Next cell
End Sub
-
Close the editor, select the range of cells, and run the macro.
This method is efficient for large datasets where formulas or Find and Replace might be too slow.
Tips and Notes
-
Find and Replace modifies original data, while SUBSTITUTE keeps the original data intact.
-
Flash Fill works well for predictable patterns but might fail if patterns are inconsistent.
-
Always back up your data before using VBA macros.
This covers all effective ways to remove dashes in Excel, from manual to automated solutions.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to sort by highlighted cells in excel
Answers · 1
How to sort excel by column and keep rows together
Answers · 1
How to sort by time in excel
Answers · 1
How to sort alphabetically in excel by last name
Answers · 1