+ Reply to Thread
Results 1 to 17 of 17

Truncate At Specific Character Formula - And More. - Help Needed.

  1. #1
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Question Truncate At Specific Character Formula - And More. - Help Needed.

    This is probably an easy one, but I'm a bit confused on how to do it. Plus this would probably help others in the future as well. I basically need to take any amount of characters and truncate it to 150, BUT if it does not have a period on the end then it needs to be truncated to the closest period.


    Example:

    I saw a man climbing down a water pipe. He had a knife in his hand. I hit his hand with a brick. He fell down on the ground and I jumped upon him. Soon others reached there and we handed him over to the police.

    Needed Solution:

    I saw a man climbing down a water pipe. He had a knife in his hand. I hit his hand with a brick. He fell down on the ground and I jumped upon him.

    Current Solution that needs fixing:

    Formula: =LEFT(C2,150)

    I saw a man climbing down a water pipe. He had a knife in his hand. I hit his hand with a brick. He fell down on the ground and I jumped upon him. Soo


    -------All help greatly appreciated.

  2. #2
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    P.S if mod, can update the title of this thread to just truncate at specific character formula - I think that would be better and more neat because the title is the first thing, I wrote and wasn't really thinking about it.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,627

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    If String is in A1, Try this

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Try this..

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    to the closest period
    in above case closet period always greater than 150..
    Do you need it less that 150 alwasy..
    Last edited by Debraj Roy; 08-06-2013 at 02:59 AM.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,190

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    This is cumbersome, but does return the desired result...

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by kvsrinivasamurthy View Post
    If String is in A1, Try this

    Please Login or Register  to view this content.
    This one does not work for most cases.

  7. #7
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by Debraj Roy View Post
    Try this..

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    in above case closet period always greater than 150..
    Do you need it less that 150 alwasy..
    This works for all cases, except it needs to be under 150 characters. Not over 150.

  8. #8
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by Glenn Kennedy View Post
    This is cumbersome, but does return the desired result...

    Please Login or Register  to view this content.
    This one works for all, EXCEPT when it does not find a period before 150, then it just gives #VALUE!

  9. #9
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    then try this..
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Figured I'd throw my hat in the ring...
    Please Login or Register  to view this content.
    If there is no period in the first 150 characters, it simply returns the first 150 characters. Do you want it to return something different?
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  11. #11
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by Debraj Roy View Post
    then try this..
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This one does make it under 150, but cuts it off in the middle of the sentence.

  12. #12
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by tigeravatar View Post
    Figured I'd throw my hat in the ring...
    Please Login or Register  to view this content.
    If there is no period in the first 150 characters, it simply returns the first 150 characters. Do you want it to return something different?
    This one works pretty well under the conditions that i tested it on, but It needs to be tweeked to end on a period with a space because i noticed that if there is a word with a period in it, it cuts it off there. I tested the tweeked version and so far, it works pretty well. Going to test it on the full file that i have at home and update if it worked or not.

  13. #13
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    now got it..
    you want complete sentence.. then try this..

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,627

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    TRy this Array formula.Press Ctrl+Shift+Enter together insted of Enter Key.

    Please Login or Register  to view this content.
    Last edited by kvsrinivasamurthy; 08-07-2013 at 05:11 AM.

  15. #15
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by TheProffesional View Post
    This one works pretty well under the conditions that i tested it on, but It needs to be tweeked to end on a period with a space because i noticed that if there is a word with a period in it, it cuts it off there. I tested the tweeked version and so far, it works pretty well. Going to test it on the full file that i have at home and update if it worked or not.
    This WORKS! No errors for all them. Thanks a lot.

  16. #16
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by Debraj Roy View Post
    now got it..
    you want complete sentence.. then try this..

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This still gives #Value! for some of them.

  17. #17
    Registered User
    Join Date
    11-21-2012
    Location
    New York
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: Truncate At Specific Character Formula - And More. - Help Needed.

    Quote Originally Posted by kvsrinivasamurthy View Post
    TRy this Array formula.Press Ctrl+Shift+Enter together insted of Enter Key.

    Please Login or Register  to view this content.
    Thanks for the formula, but I found one that works well already. Either way thanks for helping out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula Needed To Truncate Postcodes
    By Dom2066 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-27-2012, 03:03 AM
  2. I am trying to truncate cells in a column from a specific character in a string
    By goldbeje in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-27-2012, 09:20 PM
  3. [SOLVED] I am trying to truncate cells in a column from a specific character in a string
    By goldbeje in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2012, 11:31 AM
  4. Truncate all characters left of 6th character
    By fredmeister in forum Excel General
    Replies: 3
    Last Post: 02-09-2010, 04:41 PM
  5. Truncate cell content after a certain character
    By brakai295 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2006, 07:33 AM

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