Moving some text to the next cell

thedrizzle

New Member
Joined
Oct 8, 2018
Messages
5
Hi all, I've got a large data set (roughly 1,500 cells) that I need to split out. They are currently formatted like this:

[TABLE="width: 410"]
<colgroup><col></colgroup><tbody>[TR]
[TD]CHICOPEE, MA TO Rocky Mount, NC[/TD]
[/TR]
[TR]
[TD]MCDONOUGH, GA TO ROCKY MOUNT, NC[/TD]
[/TR]
[TR]
[TD]ATLANTA, GA TO ORLANDO, FL

I'm trying to separate this into four cells - City, St, City, St. Each cell is split in half with the word "TO", but I can't figure out how to separate everything after the word "TO" into the next cell since they're all different lengths. Once I do separate them, I can use the delimiter on the comma to separate each city from its state.

Anybody know how to do this?[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
You COULD do a find/replace and change " TO " to ", " and then do text-to-columns.
 
Upvote 0
Welcome to the MrExcel board!

This could be done directly by formulas, but this may suit you better?

Select the column & do a Find/Replace: Find: " TO " (without the quotes but with the surrounding spaces) & a comma in the Replace with box & ensure 'Match entire cell contents' is not checked in Options.
Do another Find/replace to replace comma space with just comma
Now do Text to Columns with comma as the delimiter.
 
Upvote 0
If you might be interested in a formula approach, each formula below copied down.

Excel Workbook
ABCDE
1CHICOPEE, MA TO Rocky Mount, NCCHICOPEEMARocky MountNC
2MCDONOUGH, GA TO ROCKY MOUNT, NCMCDONOUGHGAROCKY MOUNTNC
3ATLANTA, GA TO ORLANDO, FLATLANTAGAORLANDOFL
Split text
 
Upvote 0
Peter, this worked perfectly, thank you so much. i even got the delimiting done in one step by setting the comma and the colon both as delimiters.
 
Upvote 0
thank you, this worked well, I changed to " TO " to a ":" and then just delimited from there. Much appreciated
 
Upvote 0
:warning: It may not matter to you but if you didn't do the second Find/replace I mentioned (replace comma space with comma) then most of your results will have leading or trailing spaces.
 
Upvote 0
Oh yeah sorry I replaced the " TO " with a colon instead of a comma.
But really that just complicates (only slightly, I know) the TTC as you have to specify 2 delimiters instead of just 1. :)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
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