Q: parse string
On Fri, 21 Oct 2005 12:56:02 -0700, JIM.H.
wrote:
Hello
I have a string in cell that has 4 words in it.
Like “xyz abs xyt ttq”, how can I get each of this value in a different cell
with a formula?
Thanks,
As has been previously pointed out, the Text-to-Columns wizard would work well
for this problem. But since you specified formulas, using built in Excel
formulas, with your string in A1:
B1: (first word) =LEFT(A1,FIND(" ",A1)-1)
C1: (second word)
=MID($A$1,1+FIND(CHAR(1),SUBSTITUTE(
$A$1," ",CHAR(1),1)),-1+FIND(CHAR(1),
SUBSTITUTE($A$1," ",CHAR(1),2))-FIND(
CHAR(1),SUBSTITUTE($A$1," ",CHAR(1),1)))
D1: (third word)
=MID($A$1,1+FIND(CHAR(1),SUBSTITUTE(
$A$1," ",CHAR(1),2)),-1+FIND(CHAR(1),
SUBSTITUTE($A$1," ",CHAR(1),3))-FIND(
CHAR(1),SUBSTITUTE($A$1," ",CHAR(1),2)))
E1: (4th word)
=RIGHT(A1,LEN(A1)-FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),3)))
--ron
|