Return Word(s) from the RIGHT hand side of a string

Naughty Norbert

New Member
Joined
Apr 6, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,
I've been searching to find a solution for my problem and this site seems to be the most suitable to ask my question. I have seen it asked before, but the solutions don't actually provide the required outcome. So here goes:
I have a long list of names and email addresses that I wish to convert into columns of first, last and email. I'm ok with splitting off the email address but have been stumped by the variety of the names.
1 Name and Email First Name(s) Last Name email Address
2 Bob Bobski Bob@BobSky.com Bob Bobski Bob@bobsky.com
3 Harriet Hartebeest BeestlyHarry@Gmail.com Harriet Hartebeest BeestlyHarry@Gmail.com
4 John and Joan Bubble-Head JanjGazprom@Oilwell.com John and Joan Bubble-Head JanjGazprom@Oilwell.com
5 Herb and Daisy Flowers FlowerPower@GMCrops.co.uk Herb and Daisy Flowers FlowerPower@GMCrops.co.uk
6 Willy and Fanny Bottomley The Bumlies@gmail.com Willy and Fanny Bottomley The Bumlies@gmail.com
7 V. Sharp DangerousMan@gmail.com V. Sharp DangerousMan@gmail.com
etc.
As I say, I can split the column up through a simple formula: =MID(A2,FIND(" ",A2,1),100) But this cannot give me the surname on lines 4-6. What I need is a formula that finds the first space from the right hand side of the string and returns it. I would envisage the pseudo-code being from [cell] find last space char and return all characters after it. I just don't know how to do it. I would be very happy if someone could give me the solution.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
What do you want the result to be when there's an "and" between the names?

It would be helpful if you used XL2BB to show your data and sample result(s).

Maybe this? (one email isn't valid, so I adjusted it)

Book3
ABC
2Bob Bobski Bob@BobSky.com Bob Bobski Bob@bobsky.comBob BobskiBob@bobsky.com
3Harriet Hartebeest BeestlyHarry@Gmail.com Harriet Hartebeest BeestlyHarry@Gmail.comHarriet HartebeestBeestlyHarry@Gmail.com
4John and Joan Bubble-Head JanjGazprom@Oilwell.com John and Joan Bubble-Head JanjGazprom@Oilwell.comJohn and Joan Bubble-HeadJanjGazprom@Oilwell.com
5Herb and Daisy Flowers FlowerPower@GMCrops.co.uk Herb and Daisy Flowers FlowerPower@GMCrops.co.ukHerb and Daisy FlowersFlowerPower@GMCrops.co.uk
6Willy and Fanny Bottomley The_Bumlies@gmail.com Willy and Fanny Bottomley The_Bumlies@gmail.comWilly and Fanny BottomleyThe_Bumlies@gmail.com
7V. Sharp DangerousMan@gmail.com V. Sharp DangerousMan@gmail.comV. SharpDangerousMan@gmail.com
Sheet7
Cell Formulas
RangeFormula
B2:B7B2=IF(ISERROR(FIND("and", A2)),TEXTBEFORE(A2," ",2),TEXTBEFORE(A2," ",4))
C2:C7C2=IF(ISERROR(FIND("and", A2)),TEXTAFTER(A2," ",5),TEXTAFTER(A2," ",9))
 
Upvote 0
Seems the website has stripped out the spaces I used to make the 'data' more readable. Now it looks like a duplication. The second set was supposed to look as if it was in separate columns. I've uploaded a screen grab of my data
 

Attachments

  • Excel_Problem.png
    Excel_Problem.png
    15.8 KB · Views: 13
Upvote 0
I'm not sure what your data is based on your first post then the screen shot. Again, please use XL2BB to illustrate.
 
Upvote 0
Hi K. Thanks for you response - the first names would need to be in a separate column. I'm OK with the 'ands' as they stand,
Your solution brings the names out beautifully. . Thank you very much.
Now How do I extract the last names from the sub set this produces?
 
Upvote 0
Very Impressed with this XL2BB thing. Here is a simplified version of m y problem. You'll see the 'and' issue quite well here.

Membership.csv
BCD
62Ben Evertsson Ben Evertsson
63Paul Batty Paul Batty
64Rosie BoothRosie Booth
65John and Pat Currie John and Pat Currie
66Les and Angie Kerkham Les and Angie Kerkham
67Terry and Lynda LoganTerry and Lynda Logan
68Chris Tina and Emily Matthews Chris Tina and Emily Matthews
69Edwin Page Edwin Page
70Rodney and Hazel RobertsRodney and Hazel Roberts
71Katy SteventonKaty Steventon
72Joan Whitaker Joan Whitaker
73Brian and Anne Wilks Brian and Anne Wilks
Membership
Cell Formulas
RangeFormula
C62:C73C62=LEFT(B62,FIND(" ",B62,1))
D62:D73D62=RIGHT(B62,LEN(B62)-FIND(" ",B62))
 
Upvote 0
If @kweaver's solution worked for you (ie you have TextAfter and Before) just leverage off that.

Book1
BCD
62Ben Evertsson BenEvertsson
63Paul Batty PaulBatty
64Rosie BoothRosieBooth
65John and Pat Currie John and PatCurrie
66Les and Angie Kerkham Les and AngieKerkham
67Terry and Lynda LoganTerry and LyndaLogan
68Chris Tina and Emily Matthews Chris Tina and EmilyMatthews
69Edwin Page EdwinPage
70Rodney and Hazel RobertsRodney and HazelRoberts
71Katy SteventonKatySteventon
72Joan Whitaker JoanWhitaker
73Brian and Anne Wilks Brian and AnneWilks
Sheet1
Cell Formulas
RangeFormula
C62:C73C62=TEXTBEFORE(TRIM(B62)," ",-1)
D62:D73D62=TEXTAFTER(TRIM(B62)," ",-1)
 
Upvote 0
Maybe
Fluff.xlsm
ABCD
1
2Bob Bobski Bob@BobSky.comBob BobskiBob@BobSky.com
3Harriet Hartebeest BeestlyHarry@Gmail.comHarriet HartebeestBeestlyHarry@Gmail.com
4John and Joan Bubble-Head JanjGazprom@Oilwell.comJohn and Joan Bubble-HeadJanjGazprom@Oilwell.com
5Herb and Daisy Flowers FlowerPower@GMCrops.co.ukHerb and Daisy FlowersFlowerPower@GMCrops.co.uk
6Willy and Fanny Bottomley The_Bumlies@gmail.comWilly and Fanny BottomleyThe_Bumlies@gmail.com
7V. Sharp DangerousMan@gmail.comV. SharpDangerousMan@gmail.com
Summary
Cell Formulas
RangeFormula
B2:B7B2=TEXTBEFORE(A2,C2)
C2:C7C2=TEXTAFTER(TEXTBEFORE(A2," ",-1)," ",-1)
D2:D7D2=TEXTAFTER(A2," ",-1)
 
Upvote 0
@Fluff, the formula in B2 (first name) is leaving the space at the end and will need a Trim added to it (or a space added to the front of C2)
Excel Formula:
=TRIM(TEXTBEFORE(A2,C2))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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