How to Remove Dashes in Excel
Removing dashes in Excel can streamline your data, improve readability, and ensure consistency. Still, whether you’re cleaning up a dataset for analysis, preparing a report, or organizing contact information, eliminating unnecessary dashes is a common task. This guide will walk you through multiple methods to remove dashes in Excel, from simple manual edits to advanced formulas and tools Worth keeping that in mind..
Why Remove Dashes in Excel?
Dashes often appear in Excel data due to formatting inconsistencies, manual entry errors, or data imports from external sources. To give you an idea, phone numbers might include hyphens (e.g., “123-456-7890”), or product codes might have dashes separating segments (e.g., “A-123-B”). While dashes can sometimes serve a purpose, they may also cause issues in formulas, data analysis, or integration with other systems. Removing them ensures your data is clean, standardized, and ready for use And that's really what it comes down to. Turns out it matters..
Method 1: Manual Removal
The simplest way to remove dashes is to edit cells directly. This method works best for small datasets or when only a few cells contain dashes It's one of those things that adds up..
- Select the Cell: Click on the cell containing the dash.
- Delete the Dash: Use the backspace key or delete key to remove the dash.
- Repeat for All Cells: If multiple cells need editing, repeat the process for each one.
Pros: Quick and straightforward for small tasks.
Cons: Time-consuming for large datasets.
Method 2: Using the Find and Replace Tool
For larger datasets, the Find and Replace feature saves time. This method allows you to replace all dashes in a range with a single action Simple, but easy to overlook. Worth knowing..
- Select the Range: Highlight the cells or columns containing dashes.
- Open Find and Replace: Press
Ctrl + Hto open the Find and Replace dialog box. - Enter the Text to Find: Type
-in the "Find what" field. - Leave "Replace with" Blank: This ensures dashes are removed entirely.
- Click Replace All: Excel will replace all dashes in the selected range with nothing.
Pros: Efficient for bulk data.
Cons: Removes all dashes, which may not be ideal if some dashes are intentional.
Method 3: Using Formulas
If you need to keep dashes in some parts of the data while removing them in others, formulas offer flexibility. Two common approaches are the SUBSTITUTE and TEXTJOIN functions Less friction, more output..
Using SUBSTITUTE
The SUBSTITUTE function replaces specific characters in a text string.
- Enter the Formula: In a new cell, type:
Replace=SUBSTITUTE(A1, "-", "")A1with the cell containing the dash. - Copy the Formula: Drag the fill handle down to apply it to other cells.
- Replace Original Data: Copy the results and use Paste Special > Values to overwrite the original data.
Pros: Non-destructive; preserves other data.
Cons: Requires an extra column for results.
Using TEXTJOIN
For more complex scenarios, TEXTJOIN can combine text while removing dashes.
- Enter the Formula:
This splits the text at dashes and joins the parts without them.=TEXTJOIN("", TRUE, SPLIT(A1, "-")) - Copy and Paste Values: As with
SUBSTITUTE, replace the original data.
Pros: Handles multiple dashes and complex strings.
Cons: Requires Excel 2016 or later for TEXTJOIN.
Method 4: Using Power Query
Power Query is a powerful tool for data transformation, especially for large datasets. It allows you to remove dashes programmatically Worth keeping that in mind..
- Load Data into Power Query:
- Select your data range.
- Go to the Data tab and click From Table/Range.
- Open Power Query Editor:
- Click Transform Data to open the Power Query Editor.
- Replace Dashes:
- In the Home tab, click Replace Values.
- In the "Find what" field, type
-. - Leave the "Replace with" field blank.
- Apply Changes: Click Close & Load to update your worksheet.
Pros: Efficient for large datasets and repeated use.
Cons: Requires familiarity with Power Query.
Method 5: Using VBA Macros
For advanced users, VBA (Visual Basic for Applications) can automate dash removal. This method is ideal for repetitive tasks or custom scripts.
- Open the VBA Editor: Press
Alt + F11to open the VBA editor. - Insert a Module: Right-click your workbook in the Project Explorer, select Insert > Module.
- Paste the Code:
Sub RemoveDashes() Dim cell As Range For Each cell In Selection cell.Value = Replace(cell.Value, "-", "") Next cell End Sub - Run the Macro: Close the editor, select the cells, and press
Alt + F8to run the macro.
Pros: Fully customizable and scalable.
Cons: Requires basic VBA knowledge.
Best Practices for Removing Dashes
- Backup Your Data: Always create a copy of your file before making bulk changes.
- Check for Intentional Dashes: check that dashes aren’t part of the data’s structure (e.g., in codes or labels).
- Test on a Small Sample: Try the method on a few cells first to avoid errors.
- Use Conditional Formatting: Highlight cells with dashes to identify them quickly.
Common Scenarios and Solutions
- Phone Numbers: Use
SUBSTITUTEto remove hyphens and spaces, then format the result as a number. - Product Codes: Replace dashes with underscores or remove them entirely for consistency.
- Text Strings: Combine
SUBSTITUTEandTRIMto clean up extra spaces after removing dashes.
Conclusion
Removing dashes in Excel is a versatile task with multiple solutions depending on your needs. For small datasets, manual editing or Find and Replace works well. For larger data, formulas like SUBSTITUTE or tools like Power Query offer efficiency. Advanced users can use VBA for automation. By choosing the right method, you can ensure your data is clean, consistent, and ready for analysis. Whether you’re a beginner or an expert, mastering these techniques will save time and improve the quality of your Excel work.
Final Thoughts
Whatever your workflow—whether you’re a data analyst juggling thousands of rows, a marketer cleaning up customer lists, or a student tidying up a homework assignment—removing dashes in Excel is a quick win that pays off in accuracy and downstream efficiency. By combining the right tool for the job—be it a one‑off Find & Replace, a strong SUBSTITUTE formula, a tidy Power Query step, or a reusable VBA macro—you can keep your spreadsheets clean, consistent, and ready for whatever comes next.
Take the time to experiment with a few of the methods above, and you’ll find that the right solution often emerges from the specific shape of your data. Happy cleaning!
Automating the Process with a Button (No‑Code Approach)
If you love the convenience of a one‑click solution but don’t want to dive into VBA code, Excel’s Quick Access Toolbar (QAT) can be turned into a pseudo‑button for the built‑in Find & Replace command Worth keeping that in mind. Worth knowing..
-
Add Find & Replace to the QAT
- Click the dropdown arrow at the far right of the QAT.
- Choose More Commands…
- In the Choose commands from list, select All Commands.
- Scroll down to Find & Replace… and click Add >>.
- Click OK.
-
Create a Macro‑Free “Run” Button
- Highlight the range you want to clean.
- Click the newly added Find & Replace icon on the QAT.
- In the dialog box, type
-in Find what, leave Replace with blank, and click Replace All.
Now you have a single icon that does exactly what you need, without ever opening the VBA editor. It’s especially handy for users who need to repeat the operation across multiple workbooks throughout the day.
Using Power Query for Ongoing Data Refreshes
When your data source is external (e.So g. , a CSV export from an ERP system) and you need to refresh the data regularly, handling dash removal inside Power Query guarantees that every refresh yields clean results.
- Load the Data into Power Query –
Data > Get Data > From File > From Workbook/CSV. - Select the Column(s) – Click the column header(s) that contain dashes.
- Apply a Transform –
- Go to Transform > Replace Values.
- In the dialog, type
-for Value To Find and leave Replace With empty. - Click OK.
- Close & Load – Choose Close & Load To… and pick Table or Only Create Connection depending on whether you need the data in the sheet or just as a source for further modeling.
Because Power Query stores the transformation steps, you never have to remember to run a macro or apply a formula again—the dash removal is baked into the data pipeline Took long enough..
Leveraging Dynamic Arrays (Excel 365/2021)
If you’re on a version of Excel that supports dynamic array formulas, you can clean an entire column without helper columns or copying values back and forth That's the whole idea..
=LET(
src, A2:A1000,
clean, SUBSTITUTE(src, "-", ""),
IF(SEQUENCE(ROWS(src)), clean, "")
)
LETassigns the original range tosrcand the dash‑free version toclean.SEQUENCEforces the formula to spill into the same number of rows as the source, preserving the original layout.- Drag the formula down only once; Excel automatically expands or contracts as rows are added or removed.
Removing Dashes from PivotTable Labels
Sometimes the dash appears not in the raw data but in the field captions of a PivotTable (e.g., “2021‑Q1”).
- Click the PivotTable, then go to PivotTable Analyze > Fields, Items & Sets > Calculated Field.
- Name the field (e.g.,
CleanPeriod). - In the formula box, type:
=SUBSTITUTE('Period', "-", ""). - Add the new field to the Rows or Columns area.
Now the dash‑free version appears in the report, leaving the underlying source untouched.
Handling Edge Cases: Mixed Delimiters
Real‑world data often mixes hyphens, en‑dashes (–), and em‑dashes (—). The standard SUBSTITUTE call only catches the ASCII hyphen (-). To cover all three, nest multiple SUBSTITUTE functions:
=SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(A2, "-", ""),
"–", ""),
"—", "")
If you prefer a cleaner look, wrap the whole thing in TRIM to eliminate any stray spaces that might have been introduced:
=TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2, "-", ""), "–", ""), "—", ""))
For a VBA solution that automatically catches any dash‑type character, use the Unicode range:
cell.Value = Application.WorksheetFunction.Substitute(cell.Value, ChrW(&H2013), "")
cell.Value = Application.WorksheetFunction.Substitute(cell.Value, ChrW(&H2014), "")
Performance Tips for Very Large Datasets
- Avoid volatile functions like
NOW()orRAND()in the same sheet; they force recalculation of the entire workbook each time a dash is removed. - Turn off automatic calculation while you run a macro:
Application.Calculation = xlCalculationManual, then restore it after the macro finishes. - Write results back in bulk rather than cell‑by‑cell. In VBA, collect the cleaned values in an array, then assign the array back to the range in one operation—this can cut runtime dramatically for >100,000 rows.
Dim arr As Variant, i As Long
arr = Selection.Value
For i = 1 To UBound(arr, 1)
arr(i, 1) = Replace(arr(i, 1), "-", "")
Next i
Selection.Value = arr
Quick Reference Cheat Sheet
| Situation | Recommended Tool | One‑Liner |
|---|---|---|
| One‑off clean‑up on a few cells | Find & Replace | Ctrl+H → "-" → "" → Replace All |
| Clean column with a formula | SUBSTITUTE |
=SUBSTITUTE(A2, "-", "") |
| Ongoing imports, need repeatable steps | Power Query | Replace Values step in query editor |
| Need a reusable button | VBA macro | Sub RemoveDashes() … End Sub |
| Office 365, love spill formulas | Dynamic arrays | =LET(src, A2:A, SUBSTITUTE(src, "-", "")) |
| Mixed dash characters | Nested SUBSTITUTE |
=TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"-",""),"–",""),"—","")) |
Final Takeaway
Cleaning dashes from Excel data isn’t a one‑size‑fits‑all task; it’s a toolbox of techniques that you can mix and match based on data volume, frequency of the operation, and your comfort with code. By selecting the right approach—whether that’s a quick Find & Replace, a solid Power Query transformation, or a reusable VBA macro—you’ll keep your worksheets tidy, your calculations accurate, and your workflow efficient And it works..
In short: pick the simplest method that scales to your needs, safeguard your original data with a backup, and automate wherever possible. Once the dashes are gone, the rest of your analysis can proceed without the hidden hiccups that stray characters often cause. Happy Excel‑cleaning!