Rearrange data in cell

MPullen

New Member
Joined
Apr 8, 2002
Messages
13
I'm importing data from an external database.
It imports NAME as either a company name or personal name.
Company name shows as:
ABC Company LTD.
Which is great!

But when it imports a personal name, it's formated into one cell as:
PULLEN/MICHAEL

How can I automate it so I can rearrange the cell to show:
MICHAEL PULLEN

Any help is much appricated...
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
G'day MPullen

I know there's a formula approach but a quick and dirty way would be to do a DataText to Columns - "/" as the delimiter.

That would break your example into 2 columns (or more if the range has a cell with more than 1 "/").

Basically you could then concatenate the order you want: something like =B2&" "&A2

Then paste special the column as values and kill the 2 extra columns. You could use in if statement to check for blank cells if it breaks into 3 or more columns (say due to an entry like "Smith/Joe/Mary")

Kinda manual I know, but quick and dirty.

Hope that helps,
Adam
 
Upvote 0
Thanks for you help.
I've got something to work with now.

But this spreadsheet is used everyday to pull lots of data.
I was hoping to automate it.
 
Upvote 0
On 2002-04-24 11:18, MPullen wrote:
Thanks for you help.
I've got something to work with now.

But this spreadsheet is used everyday to pull lots of data.
I was hoping to automate it.

Why don't you change the query that produces the data set?
 
Upvote 0
Hey again,

Here's a formula approach that will work as long as you only have one "/" in the column. If your data is in column A:

In B2, =RIGHT(A2,LEN(A2)-LEN(LEFT(A2,FIND("/",A2)-1))-1)&" "&LEFT(A2,FIND("/",A2)-1)

'--I'm pretty sure this can be tweaked to be a bit shorter.

If you have some cells with more than one "/" then this complicates that formula a bit. I currently lack the caffeine levels in my bloodstream to play at that level. If you occasionally will end up with more than one "/"s then you may want to go with a VBA solution.

Hope that helps out somewhat,
Adam
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,939
Latest member
Leon Leenders

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