+ Reply to Thread
Results 1 to 4 of 4

Len&Right help

  1. #1
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Len&Right help

    Hi,

    I would like excel to do the following.

    If the contents of the cell in A1 has a string longer than 4, then delete everything after that 4 or capture just those four, if string is just 4, then do nothing.

    Any help would be great.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Len&Right help

    Hello,

    if you want to change the value in the cell, you will need to use a VBA macro. Are you OK with that?

    With a formula, you could just use

    =left(A1,4)

    in the next cell.

  3. #3
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Len&Right help

    If you want to retain the value in A1 and see only the first four characters in another cell, then you can use a formula like this:
    =LEFT(A1,4)

    If you want to directly truncate the value in A1 then you can use Text To Columns.
    • Select A1
    • Data > Text To Columns
    • Fixed Width > Next
    • Double click on any vertical arrows to remove them. Add an arrow at the 4 point mark. > Next
    • Select the area to the right of the vertical line and choose the "Do Not Import Column (skip)" option. > Finish.
    Hope that helps,

    Colin

    RAD Excel Blog

  4. #4
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: Len&Right help

    Thank you very much

+ 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