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
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)
xOut = xOut & VBA.Mid(pValue, i, 1)
AddSpaces = xOut
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:
Tip: if you want to remove the leading space, you can apply Kutools for Excel’s Remove Spaces utility, it can help you to remove leading spaces, trailing spaces, extra spaces or all spaces as you need.It’s full function without limitation in 30 days, please download and have a free trial now.
Add Spaces Between Names
The Best Office Productivity Tools
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
More than 300 powerful features. Supports Office/Excel
2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.
Hello, Pankaj, do you mean to remove extra space between first name and last name? If so, you can use this formula =TRIM(A1), A1 is the cell reference you want to remove extra spaces, then the you can copy and paste the result as value.