Change order of text string

GScott

New Member
Joined
Oct 12, 2013
Messages
28
Office Version
  1. 365
Platform
  1. Windows
I have a cell that contain the text (say) CITIZEN, JOE MR

What I need to do is write a formula that results in MR JOE CITIZEN in once cell.


Can anyone suggest an appropriate formula please.

thanks
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
There's probably a neater way of doing this but this works.

=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",500)),500))&" "&TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",500)),250,500))&" "&SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(A1," ",REPT(" ",500)),500)),",","")

You should really provide more example data than one instance
 
Upvote 0
Thanks, your formula is good but you are right - O do need to provide more sample data. One example I overlooked was that some names are 3 words long. For example CITIZEN, JOE CANE MR or CITIZEN, JOE-CANE MR

which I need to read MR JOE CANE CITIZEN

Can a formula be written for that situation as well as the case when there are ony two names in a person's name?

thanks
 
Upvote 0
Like this?

Excel Workbook
AB
1CITIZEN, JOE MRMR JOE CITIZEN
2CITIZEN, JOE CANE MRMR JOE CANE CITIZEN
3CITIZEN, JOE-CANE MRMR JOE-CANE CITIZEN
4CITIZEN, JOE CANE BOB FREDERICK MRMR JOE CANE BOB FREDERICK CITIZEN
Names
 
Upvote 0
Thanks Peter, that is great. Phew, I was convinced this couldn't be done.

thanks again,

gavin
 
Upvote 0
One more question...

lets say the cell contains the text CITIZEN, JOE CANE Mr (code red)

can this be read so that it is comes out as
Mr JOE CANE CITIZEN (code red)

thanks for any help

gavin
 
Upvote 0
lets say the cell contains the text CITIZEN, JOE CANE Mr (code red)

can this be read so that it is comes out as
Mr JOE CANE CITIZEN (code red)
As pointed out earlier, one example isn't much to go on. ;)

Do all rows have something in parentheses at the end or only some?

Could we have 5-10 samples & their results that show all the different cases that any formula would have to deal with?
 
Upvote 0
Thanks Peter,

Here is an example

[TABLE="width: 614"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]CITIZEN HAWKINS, ELIANE MRS[/TD]
[TD]MRS ELIANE CITIZEN HAWKINS[/TD]
[/TR]
[TR]
[TD]CITIZEN, SUSAN MRS[/TD]
[TD]MRS SUSAN CITIZEN[/TD]
[/TR]
[TR]
[TD]JOHNSON, CLINTON MR (CODE RED)[/TD]
[TD]MR CLINTON JOHNSON (CODE RED)[/TD]
[/TR]
[TR]
[TD]DEAKIN, RICHARD MR[/TD]
[TD]MR RICHARD DEAKIN[/TD]
[/TR]
[TR]
[TD]WANDAH, PETRI-SEBASTIAN MR[/TD]
[TD]MR PETRI-SEBASTIAN WANDAH[/TD]
[/TR]
[TR]
[TD]PETERS-JONES, SUZANNE MS[/TD]
[TD]MS SUZANNE PETERS-JONES[/TD]
[/TR]
[TR]
[TD]JIMBO, PER MR (YELLOW)[/TD]
[TD]MR PER JIMBO (YELLOW)[/TD]
[/TR]
[TR]
[TD]LYNCH-WATKINSON, KATIER MS[/TD]
[TD]MS KATIER LYNCH-WATKINSON[/TD]
[/TR]
[TR]
[TD]LIMBO, LI MEI MRS (CODE WHITE-ORANGE)[/TD]
[TD]MRS LI MEI LIMBO (CODE WHITE-ORANGE)[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
I should have added the column on the left is the raw data, column on the right is how I would like it to be translated.
 
Upvote 0

Forum statistics

Threads
1,223,629
Messages
6,173,437
Members
452,515
Latest member
marinacalus

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