+ Reply to Thread
Results 1 to 3 of 3

How do you truncate a text string?

  1. #1
    Registered User
    Join Date
    03-28-2006
    Posts
    1

    How do you truncate a text string?

    Hello,

    I was wondering if there's a function that allows me to chop characters of a fixed length off of text strings of varying lengths. For example, if I have the following strings:

    12345-ABC
    123456-DEF

    I want to be able to cut off the "-ABC" or the "-DEF" and be left with

    12345
    123456

    Normally, I would simply use an =LEFT to capture the part I need, but since the part before the dash is of varying lengths, I'm not sure how to do this. Any help would be appreciated.

    Thanks!

  2. #2
    jeffstew1
    Guest

    RE: How do you truncate a text string?

    Try This:

    =LEFT(A1,FIND("-",A1,1)-1) where A1 is your text.

    "dailygluttony" wrote:

    >
    > Hello,
    >
    > I was wondering if there's a function that allows me to chop characters
    > of a fixed length off of text strings of varying lengths. For example,
    > if I have the following strings:
    >
    > 12345-ABC
    > 123456-DEF
    >
    > I want to be able to cut off the "-ABC" or the "-DEF" and be left with
    >
    > 12345
    > 123456
    >
    > Normally, I would simply use an =LEFT to capture the part I need, but
    > since the part before the dash is of varying lengths, I'm not sure how
    > to do this. Any help would be appreciated.
    >
    > Thanks!
    >
    >
    > --
    > dailygluttony
    > ------------------------------------------------------------------------
    > dailygluttony's Profile: http://www.excelforum.com/member.php...o&userid=32907
    > View this thread: http://www.excelforum.com/showthread...hreadid=527259
    >
    >


  3. #3
    Peo Sjoblom
    Guest

    Re: How do you truncate a text string?

    Data > text to columns, select delimited, click next, select - as other
    delimiter click next select the right column and check do not import (skip)
    under column data format. That way you can do a whole column in one fell
    swoop


    --

    Regards,

    Peo Sjoblom



    "dailygluttony" <dailygluttony.25e7sy_1143571503.8005@excelforum-nospam.com>
    wrote in message
    news:dailygluttony.25e7sy_1143571503.8005@excelforum-nospam.com...
    >
    > Hello,
    >
    > I was wondering if there's a function that allows me to chop characters
    > of a fixed length off of text strings of varying lengths. For example,
    > if I have the following strings:
    >
    > 12345-ABC
    > 123456-DEF
    >
    > I want to be able to cut off the "-ABC" or the "-DEF" and be left with
    >
    > 12345
    > 123456
    >
    > Normally, I would simply use an =LEFT to capture the part I need, but
    > since the part before the dash is of varying lengths, I'm not sure how
    > to do this. Any help would be appreciated.
    >
    > Thanks!
    >
    >
    > --
    > dailygluttony
    > ------------------------------------------------------------------------
    > dailygluttony's Profile:
    > http://www.excelforum.com/member.php...o&userid=32907
    > View this thread: http://www.excelforum.com/showthread...hreadid=527259
    >




+ 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