Assuming data in A1:
in B1:
=LEFT(A1,FIND("-",A1)-1)
in C1:
=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"-",""))=2,MID(A1,LEN(B1)+2,FIND("-",A1,LEN(B1)+2)-(LEN(B1)+2)),RIGHT(A1,LEN(A1)-(LEN(B1)+1)))
in D1:
=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"-",""))=2,RIGHT(A1,LEN(A1)-(LEN(B1)+LEN(C1)+2)),"")
Not very elegant but works (I think!)
HTH
> Thanks for your reply Per Erik
>
[quoted text clipped - 5 lines]
>
> Mitch
Harlan Grove - 15 May 2006 23:33 GMT
Toppers wrote...
>Assuming data in A1:
>
[quoted text clipped - 7 lines]
>MID(A1,LEN(B1)+2,FIND("-",A1,LEN(B1)+2)-(LEN(B1)+2)),
>RIGHT(A1,LEN(A1)-(LEN(B1)+1)))
Could be shortened to
=MID(A1,LEN(B1)+2,FIND("-",REPLACE(A1&"-",1,LEN(B1)+1,""))-1)
>in D1:
>
>=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"-",""))=2,
>RIGHT(A1,LEN(A1)-(LEN(B1)+LEN(C1)+2)),"")
Could be shortened to
=MID(A1,LEN(B1)+LEN(C1)+3,LEN(A1))
Toppers - 16 May 2006 07:46 GMT
Thanks Harlan .... I was sure mine could be improved!
> Toppers wrote...
> >Assuming data in A1:
[quoted text clipped - 21 lines]
>
> =MID(A1,LEN(B1)+LEN(C1)+3,LEN(A1))
I see that you already have recieved an answer which ig much better
than mine. Anyways:
I used the following columns i row 1:
Original datai in A
First dash in B
Second dash i C
First digits in D
Second digits in E
Third digits in F
B2= FIND("-";A2)
C2= FIND("-";$A2;B2+1)
D2= LEFT(A2;B2-1)
E2=IF(ISERROR(C2);RIGHT(A2;B2-1);MID(A2;B2+1;C2-B2-1))
F2 =RIGHT(A2;LEN(A2-C2))
And then you need check for errors in the column F.
I think I would go for Toopers solution which seems quite briliant.
Per Erik
>Thanks for your reply Per Erik
>
[quoted text clipped - 5 lines]
>
>Mitch