Thread: Data Extraction
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Data Extraction

On Sat, 21 Jul 2007 14:51:35 +0100, "Saxman"
wrote:

On 21/07/2007 12:48:48, Ron Rosenfeld wrote:

With data in A1:

B1: =MID(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""),LEN(A1)-3,1)
C1: =MID(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""),LEN(A1)-2,1)
D1: =RIGHT(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""),1)


Thanks for the feedback.

I tried Max's solution, but it did not quite work.

The above is almost there, but I get the following errors.

0/12-F gives me 2 F F which should be 1 2 F
2/FP2- gives me P 2 2 which should be F P 2
23-1/ gives me 3 1 1 which should be 2 3 1
216/0- gives me 6 0 0 which should be 1 6 0

It appears that errors occur when a '-' or '/' is on the end. Don't know
about the first example though?

Thanks again.






Yup. Logical error. Here is the correction:

B1:
=MID(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""),
LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""))-2,1)

C1:
=MID(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""),
LEN(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""))-1,1)

D1: (unchanged)
=RIGHT(SUBSTITUTE(SUBSTITUTE(A1,"-",""),"/",""),1)



--ron