Removing the second part of data in a cell

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone

Ok so I need to remove the name from a cell with other data in it.

so lets say data is in A2

here are some examples of what it can look like

what I have: The result I want
WEb Site - Sales - Tony Tony
Web - enquiry - Tony-Snith Tony-Snith
Web equiry - Tony Tony
web Enquiry - Tony-smith Tony-smith

So basicly there is a problem

I need to seperate the data by finding the last " - " but some names have just "-" which is fine and part of what i need so how can I text the formula to
"Split data where the the last occurance of " - " (so thats "Space-Space") and give me everything to the right?

thanks

Tony
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
put the cursor in the top row of the data column, then run:

Code:
sub ExtractNames()
dim vWord

While ActiveCell.Value <> ""
    vWord=  ActiveCell.Value 
    ActiveCell.Offset(0, 1).value = mid(vWord,instrRev(vWord,"-")+1)
     
     ActiveCell.Offset(1, 0).Select  'next row
Wend
end sub
 
Upvote 0
Hi ranman,

But for reason I wont go into I need this as a formula not vba just relised I did say that sorry.

Thanks

Tony
 
Upvote 0
Try this (for an entry in cell A1):
Code:
=TRIM(RIGHT(SUBSTITUTE(A1," - ",REPT(" ",100)),100))
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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