Split full name to first and middle and last name with single formula

Prasad K

Board Regular
Joined
Aug 4, 2021
Messages
189
Office Version
  1. 2016
  2. 2007
Platform
  1. Windows
Is any only single formula to split full name as first and middle and last name
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Is any only single formula to split full name as first and middle and last name
ignore this question i have get answer
=TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",LEN($A1))),COLUMNS($A:C)*LEN($A1)-(LEN($A1)-1),LEN($A1)))
 
Upvote 0
Just because I had worked on it. But I may have interpreted the question wrongly?

TEST_MREXCEL.xlsm
ABCDEF
2Frederick Stanley SmithFrederickStanleySmith  
3Frederick Stanley Albert Reginald Smith-LewingtonFrederickStanleyAlbertReginaldSmith-Lewington
4
Sheet2
Cell Formulas
RangeFormula
B2:F3B2=TRIM(MID(SUBSTITUTE(TRIM($A2)," ",REPT(" ",100)),((COLUMNS($B:B)-1)*100)+1,100))
 
Upvote 0
Just because I had worked on it. But I may have interpreted the question wrongly?

TEST_MREXCEL.xlsm
ABCDEF
2Frederick Stanley SmithFrederickStanleySmith  
3Frederick Stanley Albert Reginald Smith-LewingtonFrederickStanleyAlbertReginaldSmith-Lewington
4
Sheet2
Cell Formulas
RangeFormula
B2:F3B2=TRIM(MID(SUBSTITUTE(TRIM($A2)," ",REPT(" ",100)),((COLUMNS($B:B)-1)*100)+1,100))
one more small help

i have recorded this below macro for split full name as first and middle and last it's working perfectly to me & i want change this macro to

When i run this macro to split names it never show the formula in cell


VBA Code:
Sub SplitNames()
'
' SplitNames Macro
'

'
    ActiveSheet.Paste
    ActiveCell.FormulaR1C1 = _
        "=TRIM(MID(SUBSTITUTE(RC1,"" "",REPT("" "",LEN(RC1))),COLUMNS(C1:C[-1])*LEN(RC1)-(LEN(RC1)-1),LEN(RC1)))"
    ActiveCell.Select
    Selection.AutoFill Destination:=ActiveCell.Range("A1:A4")
    ActiveCell.Range("A1:A4").Select
    Selection.AutoFill Destination:=ActiveCell.Range("A1:C4"), Type:= _
        xlFillDefault
    ActiveCell.Range("A1:C4").Select
    ActiveCell.Offset(4, 0).Range("A1").Select
End Sub
 
Upvote 0
if you want macro try this:
VBA Code:
Sub Macro2()
Dim Lr As Long, i As Long, j As Long
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    Range("B1").FormulaR1C1 = _
        "=TRIM(MID(SUBSTITUTE(TRIM(RC1),"" "",REPT("" "",100)),((COLUMNS(C2:C)-1)*100)+1,100))"
    Range("B1").AutoFill Destination:=Range("B1:B" & Lr)
    Range("B1:B" & Lr).AutoFill Destination:=Range("B1:H" & Lr)
    Range("B1:H" & Lr).Value = Range("B1:H" & Lr).Value
End Sub

But also you can do it with Text to column option at Data Tab with Space as Delimiter
 
Upvote 0
Or try this simpler Macro:
VBA Code:
Sub Macro2()
Dim Lr As Long, i As Long, j As Long, arr As Variant
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To Lr
     arr = Range("A" & i).Value
     Range("B" & i).Resize(, Len(arr) - Len(Replace(arr, " ", "")) + 1).Value = Split(arr, " ")
    Next i
    
End Sub
 
Upvote 0
Solution
if you want macro try this:
VBA Code:
Sub Macro2()
Dim Lr As Long, i As Long, j As Long
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    Range("B1").FormulaR1C1 = _
        "=TRIM(MID(SUBSTITUTE(TRIM(RC1),"" "",REPT("" "",100)),((COLUMNS(C2:C)-1)*100)+1,100))"
    Range("B1").AutoFill Destination:=Range("B1:B" & Lr)
    Range("B1:B" & Lr).AutoFill Destination:=Range("B1:H" & Lr)
    Range("B1:H" & Lr).Value = Range("B1:H" & Lr).Value
End Sub

But also you can do it with Text to column option at Data Tab with Space as Delimiter
Thank you so much it's working has per my request
 
Upvote 0
Or try this simpler Macro:
VBA Code:
Sub Macro2()
Dim Lr As Long, i As Long, j As Long, arr As Variant
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To Lr
     arr = Range("A" & i).Value
     Range("B" & i).Resize(, Len(arr) - Len(Replace(arr, " ", "")) + 1).Value = Split(arr, " ")
    Next i
   
End Sub
This one also working perfectly Once again Thank you so much
 
Upvote 0
Or try this simpler Macro:
VBA Code:
Sub Macro2()
Dim Lr As Long, i As Long, j As Long, arr As Variant
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To Lr
     arr = Range("A" & i).Value
     Range("B" & i).Resize(, Len(arr) - Len(Replace(arr, " ", "")) + 1).Value = Split(arr, " ")
    Next i
  
End Sub

[/CODE
[/QUOTE]

Or try this simpler Macro:
VBA Code:
Sub Macro2()
Dim Lr As Long, i As Long, j As Long, arr As Variant
    Lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 2 To Lr
     arr = Range("A" & i).Value
     Range("B" & i).Resize(, Len(arr) - Len(Replace(arr, " ", "")) + 1).Value = Split(arr, " ")
    Next i
   
End Sub
using the same logic/macro on a field containing address which is to be split based on commas instead of spaces, can we replace " " with ","? doesnt seem to work. sample text is given below:

4668 Stonecoal Road,Celina, ohio,45822
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top