PDA

View Full Version : Copy just certain data from a cell



nedy_03
02-07-2007, 08:52 AM
Hi,

In column A I have data in format : xxx/aaa/yyy. In column B I need to copyy what is before the "/" and in column C what is after the second "/".

In column A the format is not unic .. the number of characters before the "/" is variable.

Thx,
Nedy

Bob Phillips
02-07-2007, 09:18 AM
=MID(A1,FIND("/",A1)+1,FIND("/",A1,FIND("/",A1)+1)-FIND("/",A1)-1)

nedy_03
02-07-2007, 09:58 AM
The result of this formula is "aaa" ... But that isn't what I need.

EX: If I have in A1 xxx/aaa/yyy I need in B1 a formula that cpoies "xxx" from A1, and in C1 another ones that copies "yyy" from A1.

If u give a look at the attached file tou will certain understand! And sorry if I can't express myself clearly!

mdmackillop
02-07-2007, 11:29 AM
Here's a UDF (User Defined Function) solution
Function Part(Cel As Range, Bit As Long)
Part = Split(Cel, "/")(Bit - 1)
End Function

nedy_03
02-07-2007, 11:45 AM
Thx ... I love it :D ...

Bob Phillips
02-07-2007, 11:49 AM
B1: =LEFT(A1,FIND("/",A1)-1)

C1: =RIGHT(A1,LEN(A1)-FIND("/",A1,FIND("/",A1)+1)*1)