NorthbyNorthwest
Board Regular
- Joined
- Oct 27, 2013
- Messages
- 173
- Office Version
- 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.
How can this formula be amended to address situation where there is only a last name, first name?
=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 Marie | Stephanie Brown |
Evans, Lisa | #VALUE! |
Harris, Mark Jr. | Mark Harris |
Smith-Jones, Barbara Ann | Barbara Smith-Jones |
Van Patten, Richard retiring next month | Richard Van Patten |
How can this formula be amended to address situation where there is only a last name, first name?