+ Reply to Thread
Results 1 to 4 of 4

Code to get text from part of a cell

  1. #1
    Registered User
    Join Date
    09-09-2004
    Posts
    2

    Code to get text from part of a cell

    I have a worksheet with data in a column as follows

    uid=xvdcfrd,ou=people,dc=xxxxx
    uid=sdsdsd,ou=people,dc=xxxxx
    uid=fhjetyv,ou=people,dc=xcxcx

    Each of the above lines is in a single cell in the column. I need to start at the top cell and retrieve the text following the first = sign and grab the text to the first comma (in cell one in the above example, I want xvdcfrd). After retrieving the text I want to copy/move it to another column (If I delete the formula, I want to keep the retrieved data unless there is a way to write the data that I retrieve in the same column that I am performing this function on). I need the code to loop through the entire column and grab that data from each cell.

    Thanks in advance...

  2. #2
    Biff
    Guest

    Re: Code to get text from part of a cell

    Hi!

    One way: (assuming every entry starts with uid= and has at least one comma):

    =LEFT(SUBSTITUTE(A1,LEFT(A1,4),""),FIND(",",A1)-5)

    Copy down as needed.

    Not sure what you intend to do about deleting the formulas but you might try
    this:

    Select the range of formulas
    Goto Edit>Copy
    Then Edit>Paste Special>Values

    This will convert the formulas to constants.

    Then you could delete the original data BUT before you do that make sure the
    formulas extracted the correct data!

    Biff

    "Keenman" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have a worksheet with data in a column as follows
    >
    > uid=xvdcfrd,ou=people,dc=xxxxx
    > uid=sdsdsd,ou=people,dc=xxxxx
    > uid=fhjetyv,ou=people,dc=xcxcx
    >
    > Each of the above lines is in a single cell in the column. I need to
    > start at the top cell and retrieve the text following the first = sign
    > and grab the text to the first comma (in cell one in the above example,
    > I want xvdcfrd). After retrieving the text I want to copy/move it to
    > another column (If I delete the formula, I want to keep the retrieved
    > data unless there is a way to write the data that I retrieve in the
    > same column that I am performing this function on). I need the code to
    > loop through the entire column and grab that data from each cell.
    >
    > Thanks in advance...
    >
    >
    > --
    > Keenman
    > ------------------------------------------------------------------------
    > Keenman's Profile:
    > http://www.excelforum.com/member.php...o&userid=14220
    > View this thread: http://www.excelforum.com/showthread...hreadid=536246
    >




  3. #3
    Registered User
    Join Date
    09-09-2004
    Posts
    2
    Biff,

    Worked great!!! Thanks...


    Quote Originally Posted by Biff
    Hi!

    One way: (assuming every entry starts with uid= and has at least one comma):

    =LEFT(SUBSTITUTE(A1,LEFT(A1,4),""),FIND(",",A1)-5)

    Copy down as needed.

    Not sure what you intend to do about deleting the formulas but you might try
    this:

    Select the range of formulas
    Goto Edit>Copy
    Then Edit>Paste Special>Values

    This will convert the formulas to constants.

    Then you could delete the original data BUT before you do that make sure the
    formulas extracted the correct data!

    Biff

    "Keenman" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I have a worksheet with data in a column as follows
    >
    > uid=xvdcfrd,ou=people,dc=xxxxx
    > uid=sdsdsd,ou=people,dc=xxxxx
    > uid=fhjetyv,ou=people,dc=xcxcx
    >
    > Each of the above lines is in a single cell in the column. I need to
    > start at the top cell and retrieve the text following the first = sign
    > and grab the text to the first comma (in cell one in the above example,
    > I want xvdcfrd). After retrieving the text I want to copy/move it to
    > another column (If I delete the formula, I want to keep the retrieved
    > data unless there is a way to write the data that I retrieve in the
    > same column that I am performing this function on). I need the code to
    > loop through the entire column and grab that data from each cell.
    >
    > Thanks in advance...
    >
    >
    > --
    > Keenman
    > ------------------------------------------------------------------------
    > Keenman's Profile:
    > http://www.excelforum.com/member.php...o&userid=14220
    > View this thread: http://www.excelforum.com/showthread...hreadid=536246
    >

  4. #4
    Biff
    Guest

    Re: Code to get text from part of a cell

    You're welcome. Thanks for the feedback!

    Biff

    "Keenman" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Biff,
    >
    > Worked great!!! Thanks...
    >
    >
    > Biff Wrote:
    >> Hi!
    >>
    >> One way: (assuming every entry starts with uid= and has at least one
    >> comma):
    >>
    >> =LEFT(SUBSTITUTE(A1,LEFT(A1,4),""),FIND(",",A1)-5)
    >>
    >> Copy down as needed.
    >>
    >> Not sure what you intend to do about deleting the formulas but you
    >> might try
    >> this:
    >>
    >> Select the range of formulas
    >> Goto Edit>Copy
    >> Then Edit>Paste Special>Values
    >>
    >> This will convert the formulas to constants.
    >>
    >> Then you could delete the original data BUT before you do that make
    >> sure the
    >> formulas extracted the correct data!
    >>
    >> Biff
    >>
    >> "Keenman" <[email protected]> wrote
    >> in
    >> message news:[email protected]...
    >> >
    >> > I have a worksheet with data in a column as follows
    >> >
    >> > uid=xvdcfrd,ou=people,dc=xxxxx
    >> > uid=sdsdsd,ou=people,dc=xxxxx
    >> > uid=fhjetyv,ou=people,dc=xcxcx
    >> >
    >> > Each of the above lines is in a single cell in the column. I need

    >> to
    >> > start at the top cell and retrieve the text following the first =

    >> sign
    >> > and grab the text to the first comma (in cell one in the above

    >> example,
    >> > I want xvdcfrd). After retrieving the text I want to copy/move it

    >> to
    >> > another column (If I delete the formula, I want to keep the

    >> retrieved
    >> > data unless there is a way to write the data that I retrieve in the
    >> > same column that I am performing this function on). I need the code

    >> to
    >> > loop through the entire column and grab that data from each cell.
    >> >
    >> > Thanks in advance...
    >> >
    >> >
    >> > --
    >> > Keenman
    >> >

    >> ------------------------------------------------------------------------
    >> > Keenman's Profile:
    >> > http://www.excelforum.com/member.php...o&userid=14220
    >> > View this thread:

    >> http://www.excelforum.com/showthread...hreadid=536246
    >> >

    >
    >
    > --
    > Keenman
    > ------------------------------------------------------------------------
    > Keenman's Profile:
    > http://www.excelforum.com/member.php...o&userid=14220
    > View this thread: http://www.excelforum.com/showthread...hreadid=536246
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1