Convert the order the first and last name is written via formula

polska2180

Active Member
Joined
Oct 1, 2004
Messages
384
Office Version
  1. 365
Hi assuming I have

"Driver Name: Donald Williams Jr" in Cell A1 in B1 I am looking formula that will show "Williams Jr, Donald"

...not sure if that is possible so the other option is in B1 have just "Donald Williams Jr" then in C1 "Williams Jr, Donald"

thanks for the help.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
How about
=MID(B1,FIND(" ",B1)+1,LEN(B1))&", "&LEFT(B1,FIND(" ",B1)-1)

edit:- think I might have misread it, I didn't notice that the text, "Driver Name" was in the same cell.
 
Last edited:
Upvote 0
If you combine those two formulas in B1, you'd have this mess:

Code:
=MID(MID(A1,FIND(": ",A1)+2,50),FIND(" ",MID(A1,FIND(": ",A1)+2,50))+1,50)&", "&LEFT(MID(A1,FIND(": ",A1)+2,50),FIND(" ",MID(A1,FIND(": ",A1)+2,50))-1)
 
Upvote 0
Correcting my previous error, slighly shorter than the combined version above, but not by much.

=MID(A1,FIND("|",SUBSTITUTE(A1," ","|",3))+1,LEN(A1))&", "&TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)*2,LEN(A1)))
 
Upvote 0
Taking a different approach to the combined formula, this one looks like it works.

=SUBSTITUTE(MID(A1&", "&A1,FIND(" ",A1,14)+1,LEN(A1)+1),"Driver Name: ","")
 
Upvote 0
Let me put in my option:

=RIGHT(A1,LEN(A1)-SEARCH(" ",A1,14))&", "&MID(A1,14,SEARCH(" ",A1,14)-14)

So I assume it always starts "Driver Name: " so I know the first name starts at position 14.

The challenge is with people who use a middle name or honorifics.

AB
1Driver Name: Donald Williams JrWilliams Jr, Donald
2Driver Name: Donald WilliamsWilliams, Donald
3Driver Name: Donny Boy WilliamsBoy Williams, Donny
4Driver Name: Mary Lou WilliamsLou Williams, Mary
5Driver Name: Mr WilliamsWilliams, Mr
6Driver Name: Donald Arthur Williams IIIArthur Williams III, Donald
7Driver Name: Sir Donald Williams, EsqDonald Williams, Esq, Sir

<tbody>
</tbody>
Sheet3

Worksheet Formulas
CellFormula
B1=RIGHT(A1,LEN(A1)-SEARCH(" ",A1,14))&", "&MID(A1,14,SEARCH(" ",A1,14)-14)

<tbody>
</tbody>

<tbody>
</tbody>
 
Last edited:
Upvote 0
Another option

=REPLACE(A1,1,FIND(" ",A1,14),"")&", "&MID(A1,14,FIND(" ",A1,14)-14)
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,255
Members
448,879
Latest member
oksanana

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