How to add space between first name and last name in Excel?
Here is a list of names which need to add space to separate them as below screenshot shown, how can you quickly solve it?
Add space between first name and last name with Defined Function
Add space between first name and last name with Add Text
Add space between first name and last name with Defined Function
To add space between the first name and last name, you only can apply a Defined Function to solve in Excel.
1. Press Alt + F11 keys to open Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste below code to the blank script.
Code: Add space between names
Function AddSpaces(pValue As String) As String
'UpdatebyExtendoffice20160908
Dim xOut As String
xOut = VBA.Left(pValue, 1)
For i = 2 To VBA.Len(pValue)
xAsc = VBA.Asc(VBA.Mid(pValue, i, 1))
If xAsc >= 65 And xAsc <= 90 Then
xOut = xOut & " " & VBA.Mid(pValue, i, 1)
Else
xOut = xOut & VBA.Mid(pValue, i, 1)
End If
Next
AddSpaces = xOut
End Function
3. Save the code and close the Applications window, select a blank cell and enter this formula =AddSpaces(A1), then drag autofill handle over cells you want to apply this formula.
Add space between first name and last name with Add Text
If you are not familiar with Defined Function, you can apply Kutools for Excel’s Add Text utility to quickly add space between first name and last name.
After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)
1. Select the cells you want to add spaces, click Kutools > Text > Add Text. See screenshot:
2.In the Add Text dialog, enter a space into the Text box, check Only add to option, and select Before uppercase letters from the drop down list. See screenshot:
3. Click Ok or Apply, now a space has been added before each uppercase letter. See screenshot:
Add Spaces Between Names
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!
