Excel - Parse Name

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have to parse out names that are not consistent. The data comes in as:
Mary Smith
John J Smith

I want the out to be: Smith John J or Smith Mary. Can anyone help?
 
Easy if we use two cells. For any name (or phrase) assume a set of words
separated by a single space. First find the location of the LAST space in
the phrase. Then everything to the right of the last space goes first and
everything to the left of the last space follows.

In A1:

James L Ravenswood

In B1:

=SEARCH("|",SUBSTITUTE(A1," ","|",(LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

In C1:

=RIGHT(A1,LEN(A1)-B1) & " " & LEFT(A1,B1-1)


So B1 shows: 8
and C1 shows: Ravenswood James L
 
I have to parse out names that are not consistent. The data comes in as:
Mary Smith
John J Smith

I want the out to be: Smith John J or Smith Mary. Can anyone help?


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

would do that.
--ron
 
=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))&"
"&LEFT(A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)))-1)
 
Thanks!
--
Thanks!
Chris


Teethless mama said:
=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))&"
"&LEFT(A1,LEN(A1)-LEN(TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)))-1)
 
Thanks!

--
Thanks!
Chris


Ron Rosenfeld said:
=MID(TRIM(TRIM(A1)),FIND(CHAR(1),SUBSTITUTE(TRIM(TRIM(A1))," ",CHAR(1),
LEN(TRIM(TRIM(A1)))-LEN(SUBSTITUTE(TRIM(TRIM(A1))," ",""))))+1,255)&" "&
LEFT(TRIM(TRIM(A1)),FIND(CHAR(1),SUBSTITUTE(TRIM(TRIM(A1))," ",CHAR(1),
LEN(TRIM(TRIM(A1)))-LEN(SUBSTITUTE(TRIM(TRIM(A1))," ",""))))-1)

would do that.
--ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Inserting rows and rearranging data using VBA 6
Matching Names 5
dates inbetween 3
Need Help with VLOOKUP 4
How to sort data from rows into columns? 6
Excel Comparing two columns 1
splitting data 1
splitting name 3

Back
Top