Assistance: Swapping Last Name / First Name in Same Cell separated by comma

DougStroud

Well-known Member
Joined
Aug 16, 2005
Messages
2,968
Column B, B3-B23, swap positions of last name and first name which are separated by a comma?

Thanks...

ds
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
You will need a VBA script if you want to do this in cell, otherwise here's a formula for the cells next to the B column -


Excel 2012
BC
3Smith, AndrewAndrew Smith
Sheet1
Cell Formulas
RangeFormula
C3=SUBSTITUTE(B3,LEFT(B3,FIND(",",B3)-1)&", ","")&" "&LEFT(B3,FIND(",",B3)-1)
 
Upvote 0
Or ......

Excel 2007
BC
3Smith, AndrewAndrew Smith
Sheet2
Cell Formulas
RangeFormula
C3=RIGHT(B3,LEN(B3)-FIND(", ",B3)-1)&" "&LEFT(B3,FIND(", ",B3)-1)
 
Upvote 0
Thanks guys... This community is the most giving and generous group of people, always willing to help and asks for nothing in return. Thank you.

If I could ask one more thing for the same set of data. All the last names are capitalized, is it possible to change the letters in the last name to lower case after the first one?
 
Upvote 0
Doug,

You are welcome. We are happy to have helped.

Try...

Excel 2007
BC
3SMITH, AndrewAndrew Smith
Sheet2
Cell Formulas
RangeFormula
C3=RIGHT(B3,LEN(B3)-FIND(", ",B3)-1)&" "&PROPER(LEFT(B3,FIND(", ",B3)-1))
 
Upvote 0
Thanks guys... This community is the most giving and generous group of people, always willing to help and asks for nothing in return. Thank you.

If I could ask one more thing for the same set of data. All the last names are capitalized, is it possible to change the letters in the last name to lower case after the first one?


Excel 2012
BC
3SMITH, ANDREWAndrew Smith
Sheet1
Cell Formulas
RangeFormula
C3=PROPER(SUBSTITUTE(B3,LEFT(B3,FIND(",",B3)-1)&", ","")&" "&LEFT(B3,FIND(",",B3)-1))
 
Upvote 0
Here is a shorter formula (with less function calls) for you to consider...

=MID(B3&" "&PROPER(B3),FIND(" ",B3)+1,LEN(B3)-1)
 
Upvote 0
Here is a shorter formula (with less function calls) for you to consider...

=MID(B3&" "&PROPER(B3),FIND(" ",B3)+1,LEN(B3)-1)
Actually, this still-compact formula would be better as it would protect against people with first names that are made up of two individual names combined (like a friend of mine whose legal first name is "Mary Ann") as well as people whose last names were composed of two name (like someone I worked with whose last name was "Della Rossa")...

=MID(B3&" "&PROPER(B3),FIND(",",B3)+2,LEN(B3)-1)
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,177
Members
448,554
Latest member
Gleisner2

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