extraction

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi community

i have these data :

A B C

1 A. Yamamoto

2 Q. C. Carver

3 O. Sanchex

4 F. X. Layman

how can i extract and have it as in B column as:

A B C


1 A. Yamamoto Yamamoto A.

2 Q. C. Carver Carver Q. C.

3 O. Sanchex Sanchex O.

4 F. X. Layman Layman F. X.

thanks community for the assistance

:)
 
=RIGHT(A1,LEN(A1)-FIND("^",SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))&"
"&LEFT(A1,FIND("^",SUBSTITUTE(A1," ","^",LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))

Watch out for line wraps, they don't belong in the formula

To see what's happening:

Col B:
=LEN(A1)-LEN(SUBSTITUTE(A1," ","")) This counts the number of spaces
Col C:
=SUBSTITUTE(A1," ","^",B1) This replaces the last space with a ^
Col D:
=FIND("^",C1) This finds the position of the ^
Col E:
=RIGHT(A1,LEN(A1)-D1) This extracts the bit after the last space
Col F:
=E1&" "&LEFT(A1,D1) This adds a space and the initials

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| hi community
|
| i have these data :
|
| A B C
|
| 1 A. Yamamoto
|
| 2 Q. C. Carver
|
| 3 O. Sanchex
|
| 4 F. X. Layman
|
| how can i extract and have it as in B column as:
|
| A B C
|
|
| 1 A. Yamamoto Yamamoto A.
|
| 2 Q. C. Carver Carver Q. C.
|
| 3 O. Sanchex Sanchex O.
|
| 4 F. X. Layman Layman F. X.
|
| thanks community for the assistance
|
| :)
|
|
| --
| oldLearner57
 
=MID(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)&" "
&LEFT(A1,FIND("~",SUBSTITUTE(A1," ","~",LEN(A1)-LEN(SUBSTITUTE(A1,"
","")))))

and copy down

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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

Back
Top