Amend Formula for Manipulating Names

NorthbyNorthwest

Board Regular
Joined
Oct 27, 2013
Messages
173
Office Version
  1. 365
Hi, everyone. Hoping someone can help me with a formula. I found the following formula for manipulating names.

=LEFT(TRIM(MID(A1,SEARCH(",",A1)+1,255)),SEARCH(" ",TRIM(MID(A1,SEARCH(",",A1)+1,255)))-1)&" "&LEFT(A1,SEARCH(",",A1)-1)

The formula extracts last and first names from string, remove comma between, and reverses name to first and last names. Almost exactly what I want. The only problem I have with the formula is it returns a #VALUE! error if there is no middle name or initial, suffix like Jr., or remarks right of the last and first names. See table below.

Anderson, Donald L.Donald Anderson
Brown, Stephanie MarieStephanie Brown
Evans, Lisa
#VALUE!​
Harris, Mark Jr.Mark Harris
Smith-Jones, Barbara AnnBarbara Smith-Jones
Van Patten, Richard retiring next monthRichard Van Patten


How can this formula be amended to address situation where there is only a last name, first name?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

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