+ Reply to Thread
Results 1 to 8 of 8

Left() or Right()

  1. #1
    Registered User
    Join Date
    06-28-2005
    Posts
    48

    Left() or Right()

    Hi,

    I have a list of postcodes (zip codes) that I need to 'extract' part of and allocate to a new cell.

    eg:

    AL1 2TQ
    AL1 5RD
    AL22 9IP

    I need to take the first characters before the space however it could be 3 or 4 characters before each space. I need a formula that will start from the left and take anything before a space or one that starts from the right and takes anything before the righthand 3 characters and the space. I've tried left and right but can't quite get it to work.

    Any ideas? Thanks in advance.

  2. #2
    Forum Contributor
    Join Date
    06-23-2004
    Location
    Houston, TX
    Posts
    571
    Quote Originally Posted by giantwolf
    Hi,

    I have a list of postcodes (zip codes) that I need to 'extract' part of and allocate to a new cell.

    eg:

    AL1 2TQ
    AL1 5RD
    AL22 9IP

    I need to take the first characters before the space however it could be 3 or 4 characters before each space. I need a formula that will start from the left and take anything before a space or one that starts from the right and takes anything before the righthand 3 characters and the space. I've tried left and right but can't quite get it to work.

    Any ideas? Thanks in advance.
    Try this ...

    =left(A1,find(" ",A1)-1)

    and copy down as required.

    Regards.
    BenjieLop
    Houston, TX

  3. #3
    DaveB
    Guest

    RE: Left() or Right()

    Assume the value is in cell A1:

    To extract to the left of the space:
    =LEFT(A1,SEARCH(" ",A1))

    To extract to the right of the space:
    =RIGHT(A1,LEN(A1)-SEARCH(" ",A1))
    --
    Regards,

    Dave


    "giantwolf" wrote:

    >
    > Hi,
    >
    > I have a list of postcodes (zip codes) that I need to 'extract' part of
    > and allocate to a new cell.
    >
    > eg:
    >
    > AL1 2TQ
    > AL1 5RD
    > AL22 9IP
    >
    > I need to take the first characters before the space however it could
    > be 3 or 4 characters before each space. I need a formula that will
    > start from the left and take anything before a space or one that starts
    > from the right and takes anything before the righthand 3 characters and
    > the space. I've tried left and right but can't quite get it to work.
    >
    > Any ideas? Thanks in advance.
    >
    >
    > --
    > giantwolf
    > ------------------------------------------------------------------------
    > giantwolf's Profile: http://www.excelforum.com/member.php...o&userid=24718
    > View this thread: http://www.excelforum.com/showthread...hreadid=396875
    >
    >


  4. #4
    Dave O
    Guest

    Re: Left() or Right()

    Assuming your sample data is in cells A1:A3, you can use the FIND()
    function to locate the space, and use it as an argument in the MID()
    function. MID() is similar to LEFT() and RIGHT() but allows you to
    select the start and stop columns.

    In cell B1 I used the formula
    =MID(A1,1,FIND(" ",A1,1)-1)

    In cell C1 I used
    =MID(A1,FIND(" ",A1,1)+1,LEN(A1))


  5. #5
    Registered User
    Join Date
    06-28-2005
    Posts
    48
    Thanks to all 3 of you for your help, they all worked great. Much appreciated.

    GW

  6. #6
    RagDyer
    Guest

    Re: Left() or Right()

    FWIW,

    Your suggested formula is being distorted when displaying in my O.E. reader.

    I see your formula in upper case, like it was copied directly from the XL
    formula bar, and the <space> is depicted as
    \" \"
    backslash,dbl quote,space,backslash,dbl quote.

    I had to go into excelforum to see your actual formula,
    which was in lower case, as you might have typed it directly into the post,
    and the space was properly displayed between 2 dbl quotes.

    Does anyone know why ???
    --
    Regards,

    RD

    ---------------------------------------------------------------------------
    Please keep all correspondence within the NewsGroup, so all may benefit !
    ---------------------------------------------------------------------------

    "BenjieLop" <[email protected]> wrote
    in message news:[email protected]...
    >
    > giantwolf Wrote:
    > > Hi,
    > >
    > > I have a list of postcodes (zip codes) that I need to 'extract' part of
    > > and allocate to a new cell.
    > >
    > > eg:
    > >
    > > AL1 2TQ
    > > AL1 5RD
    > > AL22 9IP
    > >
    > > I need to take the first characters before the space however it could
    > > be 3 or 4 characters before each space. I need a formula that will
    > > start from the left and take anything before a space or one that starts
    > > from the right and takes anything before the righthand 3 characters and
    > > the space. I've tried left and right but can't quite get it to work.
    > >
    > > Any ideas? Thanks in advance.

    >
    > Try this ...
    >
    > =LEFT(A1,FIND(\" \",A1)-1)
    >
    > and copy down as required.
    >
    > Regards.
    >
    >
    > --
    > BenjieLop
    >
    >
    > ------------------------------------------------------------------------
    > BenjieLop's Profile:

    http://www.excelforum.com/member.php...o&userid=11019
    > View this thread: http://www.excelforum.com/showthread...hreadid=396875
    >



  7. #7
    Forum Contributor
    Join Date
    06-23-2004
    Location
    Houston, TX
    Posts
    571
    RD,

    I really have no idea why this is happening. I have asked around to check if they are experiencing the same thing as you are and, unfortunately, no one has. I guess this is one of the things that we have to put up with in this high tech world that we live in right now.



    Quote Originally Posted by RagDyer
    FWIW,

    Your suggested formula is being distorted when displaying in my O.E. reader.

    I see your formula in upper case, like it was copied directly from the XL
    formula bar, and the <space> is depicted as
    \" \"
    backslash,dbl quote,space,backslash,dbl quote.

    I had to go into excelforum to see your actual formula,
    which was in lower case, as you might have typed it directly into the post,
    and the space was properly displayed between 2 dbl quotes.

    Does anyone know why ???
    --
    Regards,

    RD

    ---------------------------------------------------------------------------
    Please keep all correspondence within the NewsGroup, so all may benefit !
    ---------------------------------------------------------------------------

    "BenjieLop" <[email protected]> wrote
    in message news:[email protected]...
    >
    > giantwolf Wrote:
    > > Hi,
    > >
    > > I have a list of postcodes (zip codes) that I need to 'extract' part of
    > > and allocate to a new cell.
    > >
    > > eg:
    > >
    > > AL1 2TQ
    > > AL1 5RD
    > > AL22 9IP
    > >
    > > I need to take the first characters before the space however it could
    > > be 3 or 4 characters before each space. I need a formula that will
    > > start from the left and take anything before a space or one that starts
    > > from the right and takes anything before the righthand 3 characters and
    > > the space. I've tried left and right but can't quite get it to work.
    > >
    > > Any ideas? Thanks in advance.

    >
    > Try this ...
    >
    > =LEFT(A1,FIND(\" \",A1)-1)
    >
    > and copy down as required.
    >
    > Regards.
    >
    >
    > --
    > BenjieLop
    >
    >
    > ------------------------------------------------------------------------
    > BenjieLop's Profile:

    http://www.excelforum.com/member.php...o&userid=11019
    > View this thread: http://www.excelforum.com/showthread...hreadid=396875
    >

  8. #8
    RagDyer
    Guest

    Re: Left() or Right()

    Here's where Biff saw the same thing and commented on it just a few days
    ago:

    http://tinyurl.com/dtr8t


    --
    Regards,

    RD

    ---------------------------------------------------------------------------
    Please keep all correspondence within the NewsGroup, so all may benefit !
    ---------------------------------------------------------------------------

    "BenjieLop" <[email protected]> wrote
    in message news:[email protected]...
    >
    > RD,
    >
    > I really have no idea why this is happening. I have asked around to
    > check if they are experiencing the same thing as you are and,
    > unfortunately, no one has. I guess this is one of the things that we
    > have to put up with in this high tech world that we live in right now.
    >
    >
    >
    > RagDyer Wrote:
    > > FWIW,
    > >
    > > Your suggested formula is being distorted when displaying in my O.E.
    > > reader.
    > >
    > > I see your formula in upper case, like it was copied directly from the
    > > XL
    > > formula bar, and the <space> is depicted as
    > > \" \"
    > > backslash,dbl quote,space,backslash,dbl quote.
    > >
    > > I had to go into excelforum to see your actual formula,
    > > which was in lower case, as you might have typed it directly into the
    > > post,
    > > and the space was properly displayed between 2 dbl quotes.
    > >
    > > Does anyone know why ???
    > > --
    > > Regards,
    > >
    > > RD
    > >

    >
    > --------------------------------------------------------------------------

    -
    > > Please keep all correspondence within the NewsGroup, so all may benefit
    > > !

    >
    > --------------------------------------------------------------------------

    -
    > >
    > > "BenjieLop" <[email protected]>
    > > wrote
    > > in message
    > > news:[email protected]...
    > > >
    > > > giantwolf Wrote:
    > > > > Hi,
    > > > >
    > > > > I have a list of postcodes (zip codes) that I need to 'extract'

    > > part of
    > > > > and allocate to a new cell.
    > > > >
    > > > > eg:
    > > > >
    > > > > AL1 2TQ
    > > > > AL1 5RD
    > > > > AL22 9IP
    > > > >
    > > > > I need to take the first characters before the space however it

    > > could
    > > > > be 3 or 4 characters before each space. I need a formula that

    > > will
    > > > > start from the left and take anything before a space or one that

    > > starts
    > > > > from the right and takes anything before the righthand 3 characters

    > > and
    > > > > the space. I've tried left and right but can't quite get it to

    > > work.
    > > > >
    > > > > Any ideas? Thanks in advance.
    > > >
    > > > Try this ...
    > > >
    > > > =LEFT(A1,FIND(\" \",A1)-1)
    > > >
    > > > and copy down as required.
    > > >
    > > > Regards.
    > > >
    > > >
    > > > --
    > > > BenjieLop
    > > >
    > > >
    > > >

    > > ------------------------------------------------------------------------
    > > > BenjieLop's Profile:

    > > http://www.excelforum.com/member.php...o&userid=11019
    > > > View this thread:

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

    >
    >
    > --
    > BenjieLop
    >
    >
    > ------------------------------------------------------------------------
    > BenjieLop's Profile:

    http://www.excelforum.com/member.php...o&userid=11019
    > View this thread: http://www.excelforum.com/showthread...hreadid=396875
    >



+ 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