Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Yet Another Name Format Question

I am running Excel 2003 where cell A1 is John Paul Jones. My task is to
reformat the contents of cell A1 to Jones John Paul in cell B1. Due to the
structure of the worksheet, I cannot add columns or use VBA/macros, so the
solution has to be executed in B1. Any assistance will be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Yet Another Name Format Question

On Tue, 1 Apr 2008 13:14:03 -0700, Dallas PM
wrote:

I am running Excel 2003 where cell A1 is John Paul Jones. My task is to
reformat the contents of cell A1 to Jones John Paul in cell B1. Due to the
structure of the worksheet, I cannot add columns or use VBA/macros, so the
solution has to be executed in B1. Any assistance will be greatly appreciated.


If I understand you correctly, you want to move the last word in the string in
A1 to the beginning of the string.

The following formula should do that, and, if there is only a single word in
A1, will reproduce it:

=IF(LEN(TRIM(A1))=LEN(SUBSTITUTE(A1," ","")),TRIM(A1),
MID(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1)," ",CHAR(1),
LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))+1,255)&" "&
LEFT(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1)," ",CHAR(1),
LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))-1))
--ron
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default Yet Another Name Format Question

That was exactly what I was looking for!! Thank you so much

"Ron Rosenfeld" wrote:

On Tue, 1 Apr 2008 13:14:03 -0700, Dallas PM
wrote:

I am running Excel 2003 where cell A1 is John Paul Jones. My task is to
reformat the contents of cell A1 to Jones John Paul in cell B1. Due to the
structure of the worksheet, I cannot add columns or use VBA/macros, so the
solution has to be executed in B1. Any assistance will be greatly appreciated.


If I understand you correctly, you want to move the last word in the string in
A1 to the beginning of the string.

The following formula should do that, and, if there is only a single word in
A1, will reproduce it:

=IF(LEN(TRIM(A1))=LEN(SUBSTITUTE(A1," ","")),TRIM(A1),
MID(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1)," ",CHAR(1),
LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))+1,255)&" "&
LEFT(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1)," ",CHAR(1),
LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))-1))
--ron

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Yet Another Name Format Question

On Tue, 01 Apr 2008 16:48:56 -0400, Ron Rosenfeld
wrote:

On Tue, 1 Apr 2008 13:14:03 -0700, Dallas PM
wrote:

I am running Excel 2003 where cell A1 is John Paul Jones. My task is to
reformat the contents of cell A1 to Jones John Paul in cell B1. Due to the
structure of the worksheet, I cannot add columns or use VBA/macros, so the
solution has to be executed in B1. Any assistance will be greatly appreciated.


If I understand you correctly, you want to move the last word in the string in
A1 to the beginning of the string.

The following formula should do that, and, if there is only a single word in
A1, will reproduce it:

=IF(LEN(TRIM(A1))=LEN(SUBSTITUTE(A1," ","")),TRIM(A1),
MID(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1)," ",CHAR(1),
LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))+1,255)&" "&
LEFT(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1), " ",CHAR(1),
LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))))-1))
--ron



Here's a slightly shorter routine. This must be entered as an array-formula
(hold down <ctrl<shift while hitting <enter).

I don't know which is "better"

=IF(A1="","",MID(TRIM(A1),MATCH(TRUE,ISERR(FIND(" ",
MID(TRIM(A1),ROW(INDIRECT("1:"&LEN(A1))),255))),0) ,255)
&" "&LEFT(TRIM(A1),MATCH(TRUE,ISERR(FIND(
" ",MID(TRIM(A1),ROW(INDIRECT("1:"&LEN(A1))),255))), 0)-1))

--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format question Richard Excel Discussion (Misc queries) 3 March 8th 08 03:00 PM
Format Question Ankeny JJ Excel Discussion (Misc queries) 2 November 21st 06 03:03 PM
Format % Question Stan Atshuller Excel Worksheet Functions 3 October 2nd 06 08:54 PM
Format Question VegasBurger Excel Worksheet Functions 2 June 24th 06 06:34 PM
Format question Luis Excel Discussion (Misc queries) 1 June 22nd 05 02:42 PM


All times are GMT +1. The time now is 03:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"