close

I have a worksheet where I am trying to get the first part of a string inside
a cell. See data:

ColumnA ColumnB (wanted result)
001-1- 001-1
001-10- 001-10
001-12- 001-12
001-85.98.8- 001-85.98.8

In ColA I have a dash that gives the first part (project) then the second
part can either be a task code (numeric digit) or a part number. In either
case I need the entire string upto the second dash. I was using a formula of
=Mid(a1,5) in ColB, but that of course doesn't do it. Any suggestions, and it
should be located within one column, its hard to use multiple columns to get
the answer. Then I would have used LEN() to count to second dash, etc.. It
all needs to be in one column.

=LEFT(A2,FIND(quot;-quot;,A2,FIND(quot;-quot;,A2) 1)-1)

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

quot;Rookie_Userquot; gt; wrote in message
...
gt; I have a worksheet where I am trying to get the first part of a string
inside
gt; a cell. See data:
gt;
gt; ColumnA ColumnB (wanted result)
gt; 001-1- 001-1
gt; 001-10- 001-10
gt; 001-12- 001-12
gt; 001-85.98.8- 001-85.98.8
gt;
gt; In ColA I have a dash that gives the first part (project) then the second
gt; part can either be a task code (numeric digit) or a part number. In
either
gt; case I need the entire string upto the second dash. I was using a formula
of
gt; =Mid(a1,5) in ColB, but that of course doesn't do it. Any suggestions, and
it
gt; should be located within one column, its hard to use multiple columns to
get
gt; the answer. Then I would have used LEN() to count to second dash, etc..
It
gt; all needs to be in one column.
Assuming all of your data follows the examples you provided, I think this
will work for you:

=LEFT(A1,FIND(quot;~quot;,SUBSTITUTE(A1,quot;-quot;,quot;~quot;,2),1)-1)

HTH,
Elkarquot;Rookie_Userquot; wrote:

gt; I have a worksheet where I am trying to get the first part of a string inside
gt; a cell. See data:
gt;
gt; ColumnA ColumnB (wanted result)
gt; 001-1- 001-1
gt; 001-10- 001-10
gt; 001-12- 001-12
gt; 001-85.98.8- 001-85.98.8
gt;
gt; In ColA I have a dash that gives the first part (project) then the second
gt; part can either be a task code (numeric digit) or a part number. In either
gt; case I need the entire string upto the second dash. I was using a formula of
gt; =Mid(a1,5) in ColB, but that of course doesn't do it. Any suggestions, and it
gt; should be located within one column, its hard to use multiple columns to get
gt; the answer. Then I would have used LEN() to count to second dash, etc.. It
gt; all needs to be in one column.

Your golden - thank you very much for all the help from both of you.

quot;Elkarquot; wrote:

gt; Assuming all of your data follows the examples you provided, I think this
gt; will work for you:
gt;
gt; =LEFT(A1,FIND(quot;~quot;,SUBSTITUTE(A1,quot;-quot;,quot;~quot;,2),1)-1)
gt;
gt; HTH,
gt; Elkar
gt;
gt;
gt; quot;Rookie_Userquot; wrote:
gt;
gt; gt; I have a worksheet where I am trying to get the first part of a string inside
gt; gt; a cell. See data:
gt; gt;
gt; gt; ColumnA ColumnB (wanted result)
gt; gt; 001-1- 001-1
gt; gt; 001-10- 001-10
gt; gt; 001-12- 001-12
gt; gt; 001-85.98.8- 001-85.98.8
gt; gt;
gt; gt; In ColA I have a dash that gives the first part (project) then the second
gt; gt; part can either be a task code (numeric digit) or a part number. In either
gt; gt; case I need the entire string upto the second dash. I was using a formula of
gt; gt; =Mid(a1,5) in ColB, but that of course doesn't do it. Any suggestions, and it
gt; gt; should be located within one column, its hard to use multiple columns to get
gt; gt; the answer. Then I would have used LEN() to count to second dash, etc.. It
gt; gt; all needs to be in one column.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()