Delete Text before space if exists

joferder

Board Regular
Joined
Dec 18, 2005
Messages
59
I have a list of names that I need to remove the first name if it exists. Not all of them will have it. My list may looks like this:


John Doe
Steven Smith
Johnson

I found this formula:


=MID(A2,FIND(" ",A2)+1,256)

The problem is, that if there is no first name (so no space), it will give me a #VALUE ! error.

Any ideas of what I can use to remove just the first names if it is there would be greatly appreciated.

John
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try:


Excel 2013/2016
AB
1John DoeDoe
2Steven SmithSmith
3JohnsonJohnson
Sheet1
Cell Formulas
RangeFormula
B1=IFERROR(RIGHT(A1,LEN(A1)-SEARCH(" ",A1)),A1)
 
Upvote 0
One more question. Is there a way to make it so that it will not remove the characters before the space if there is a period in it? I have a name that is St. John as a last name, so I would need the "St." on there, but this may also apply if I have a first initial.

It's not a big thing, just kind of wondering.

John
 
Upvote 0
One more question. Is there a way to make it so that it will not remove the characters before the space if there is a period in it? I have a name that is St. John as a last name, so I would need the "St." on there, but this may also apply if I have a first initial.

It's not a big thing, just kind of wondering.

John

Try:


Excel 2013/2016
AB
1John DoeDoe
2Steven SmithSmith
3JohnsonJohnson
4St. JohnSt. John
Sheet4
Cell Formulas
RangeFormula
B1=IFERROR(IF(ISNUMBER(SEARCH(".",LEFT(A1,SEARCH(" ",A1)))),A1,RIGHT(A1,LEN(A1)-SEARCH(" ",A1))),A1)
 
Upvote 0
Is there a way to make it so that it will not remove the characters before the space if there is a period in it? I have a name that is St. John as a last name, so I would need the "St." on there, but this may also apply if I have a first initial.
Does this do what you want...

=IFERROR(IFERROR(IF(FIND(".",A1)=2,MID(A1,FIND(" ",A1)+1,99),A1),MID(A1,FIND(" ",A1)+1,99)),A1)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

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