How to add hyphen between words in Excel?
In Excel, words within a cell are typically separated by spaces. However, there are situations where you might want to use hyphens to separate words instead, as illustrated in the screenshot below. For example, you may need to standardize the format of product codes, create more readable identifiers, or comply with formatting requirements for data import or export. Manually editing each cell to insert hyphens can be very time-consuming and prone to errors, especially with large datasets. This article details several practical methods to help you efficiently add hyphens between words in Excel, saving time and reducing the risk of mistakes.

Add hyphen between words by Text to Column and formula
The Text to Columns feature in Excel can split cell contents into separate columns based on delimiters such as spaces. After splitting, you can recombine the words using a formula to insert hyphens between them. This approach is useful when your data consists of consistently spaced word groups.
Applicable Scenarios: Use this solution when each cell contains words separated by spaces, and you want to add hyphens in place of those spaces. This method is straightforward if the number of words per cell is consistent. However, if your data contains varying numbers of words, additional manual adjustment of formulas may be necessary after splitting.
Tips: Before proceeding, it’s recommended to copy your original data to a backup sheet in case you need to revert later. Be aware that splitting data into multiple columns can overwrite any existing content in the columns to the right of your selection.
1. Select the list of cells where you wish to add hyphens between words, then click Data > Text to Columns. See screenshot:
2. In the first step of the Convert Text to Columns Wizard, select the Delimited option, and click Next >. In step 2, check the Space box under Delimiters. See screenshot:
3. Click Next > again to proceed to the final step of the wizard. In the Destination box, specify where you want the split data to appear (for example, select the next empty column). See screenshot:
4. Click Finish to split your data into separate columns. Then, to combine the words with hyphens, select a blank cell adjacent to your split data and enter the following formula (for example, if your words are now in columns C1 and D1): =C1&"-"&D1. Adjust the cell references as needed if there are more than two words. Apply the formula as needed for more than two split parts, for example =C1&"-"&D1&"-"&E1 if there are three words. Drag the autofill handle downwards to apply the formula to all necessary rows. See screenshot:
Precautions: After recombining, you can copy the resulting data and use Paste Values to replace the formulas with actual text if you want to further edit the contents.
Add hyphen between words by Find and Replace
The Find and Replace function in Excel provides an efficient way to replace all spaces with hyphens throughout a selected range. This solution is ideal for quickly handling large volumes of data where the only transformation required is replacing spaces with hyphen characters.
Applicable Scenarios: Use this method when you simply need to replace every space between words with a hyphen, and the contents within the cells do not require more complex manipulation. It is straightforward and works for data where words are already separated by spaces.
Tip: If you need to preserve the original data, consider copying the data to a new column before replacing spaces. Also, check for any instances of double spaces, as these will result in double hyphens after replacement unless cleaned first.
1. Select the range of cells you wish to process, then press Ctrl + H to open the Find and Replace dialog box.
2. In the dialog, under the Replace tab, type a single space (use the space bar) in the Find what field, and a hyphen (-) in the Replace with field. See screenshot:
3. Click Replace All. A dialog box will notify you how many replacements were made. Click OK to close it. As a result, all spaces between words in your selection will be replaced with hyphens. See screenshot:
4. Close the Find and Replace dialog.
Error reminder: Make sure your selection doesn’t contain any data where spaces should not be replaced, to prevent accidental formatting changes.
Add hyphen between words by Kutools for Excel
If your data does not contain spaces between words, such as concatenated text where each word starts with an uppercase letter (e.g., “MyExcelSheet”), traditional Find and Replace or Text to Columns methods will not work directly. In these cases, the Kutools for Excel add-in offers a highly efficient solution through its easy-to-use toolset.

With Kutools for Excel, you can use the Add Text utility to insert hyphens before every uppercase character. Afterwards, the Remove by Position tool can be applied to remove any unwanted leading hyphen for each cell. This is particularly effective for handling “camel case” or “Pascal case” strings (such as converting “ThisIsAName” to “This-Is-A-Name”).
Pros: No need for complex formulas or manual edits. This approach significantly streamlines the process, especially for data with variable word lengths and structures.
Precautions: Double-check the preview in the Add Text dialog before applying changes to a large dataset. Merge results are instantly visible, and you can use Undo (Ctrl+Z) if needed.
1. Select the range of data to which you want to add hyphens, then go to Kutools > Text > Add Text. See screenshot:
2. In the Add Text dialog, input a – (hyphen) in the Text box. Check Only add to, and select Before uppercase letters from the dropdown. See screenshot:
3. Click OK. Hyphens will be added before each uppercase character in your selection. Now, to remove an unwanted leading hyphen, click Kutools > Text > Remove by Position. See screenshot:
4. In the Remove by Position dialog, enter 1 in the Numbers box, and select From left under Position. Confirm your choice. See screenshot:
5. Click OK to complete. The final result will be that a hyphen appears only between words.
Troubleshooting: If the result isn't as expected, check that your selection doesn't contain extra uppercase letters where you don't want hyphens, or consider adjusting your data for cleaner results before applying the toolset.
Demo: Add Hyphen between Words using Kutools for Excel
Add hyphen between words or before uppercase letters by VBA macro
For Excel users comfortable with macros, a customized VBA script provides an efficient way to automatically add hyphens between words separated by spaces, or to insert hyphens before each uppercase letter when there are no separators. This method is especially valuable for repetitive processing of large worksheets or when you want to add hyphens in a more refined or conditionally controlled manner.
Applicable Scenarios: This solution is suitable when you require more flexibility, such as inserting hyphens before uppercase letters in concatenated text (e.g., “MyAccountNumber” to “My-Account-Number”), or you want the process to be automated for multiple ranges. Unlike built-in features, a macro can be tailored for special word boundary logic, batch processing, or for handling new data by running the macro again at any time.
Pros and Cons: This solution is highly repeatable and can be customized, but requires enabling macros, which may be restricted by security settings in some environments. Always save your workbook before running new macros.
Troubleshooting: If you encounter "Macros are disabled" warnings, ensure you have appropriate permissions and that your file is saved in a macro-enabled format (*.xlsm).
How to use:
1. Click Developer > Visual Basic. In the Microsoft Visual Basic for Applications window, select Insert > Module, and paste the code below into the Module panel:
Sub InsertHyphensInSelection()
Dim rng As Range
Dim cell As Range
Dim txt As String
Dim i As Integer
Dim newTxt As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
If TypeName(Selection) <> "Range" Then Exit Sub
Set rng = Application.InputBox("Select cells to insert hyphens:", xTitleId, Selection.Address, Type:=8)
For Each cell In rng
If Not IsEmpty(cell.Value) Then
txt = cell.Value
' Option1: Replace spaces with hyphens
If InStr(txt, " ") > 0 Then
cell.Value = Replace(txt, " ", "-")
Else
' Option2: Insert hyphens before uppercase letters (except the first character)
newTxt = Left(txt, 1)
For i = 2 To Len(txt)
If Mid(txt, i, 1) Like "[A-Z]" Then
newTxt = newTxt & "-" & Mid(txt, i, 1)
Else
newTxt = newTxt & Mid(txt, i, 1)
End If
Next i
cell.Value = newTxt
End If
End If
Next cell
End Sub
2. Close the VBA editor. To run the macro, go back to Excel, select the range of cells you want to process, and press F5 key or click Run.
- If a cell contains spaces, all spaces will be replaced by hyphens.
- If there are no spaces (i.e., a concatenated word), a hyphen will be inserted before each uppercase letter (except the first one).
Parameter Note: The macro processes all selected cells; empty cells will be skipped.
Tips: Try the macro on a sample copy of your data to ensure you understand the transformation behavior before applying it to the original dataset.
When processing large datasets, always consider performing operations on a backup sheet or using Excel’s Undo to recover from unexpected results. If working with mixed styles of text (some cells with spaces, some with concatenated words), choose the tool or method best suited for the cell contents. The VBA macro solution is particularly flexible and can be further customized if your data has unique requirements. And if you frequently perform such formatting, automating with a macro or using Kutools for Excel can significantly boost your productivity.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in