Split data in single cell

jwp

New Member
Joined
Aug 31, 2011
Messages
33
Hi

I am so close but am struggling can someone help complete my code.

I have the following in a single cell there are 2 posibilities the data is either split by " v " or a " - " I want the data split by these 2 posible characters and put into 2 cells.

Sample Data in 1 cell

Joe Bloggs v Fred Flinstone
Jeremy Clarkson - The Stig

I want this in 2 cells like
Joe Bloggs
Fred Flinstone

or
Jeremy Clarkson
The Stig


My code so far is working to split the first name with v or - but I can only paste the first name into a cell.

Code:
x=split(cell.offset(1,0), " v ")
Sheets("Temp").Range("A1") = x
Thank you for any help provided
 
Actualy, I noticed that mine would fail with David v Goliath. Try merging the two
Code:
X = Split(Replace(Cell.Offset(1, 0), " - ", " v ") & " v ", " v ")
Range("B1").Value = X(0)
Range("B2").Value = X(1)
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You the man that works a treat.

Thank you for spending the time to get that right for me.
 
Upvote 0

Forum statistics

Threads
1,224,884
Messages
6,181,555
Members
453,053
Latest member
Kiranm13

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