+ Reply to Thread
Results 1 to 16 of 16

Formula for Extracting the Last Character in Each Cell - Please Help!

  1. #1
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Formula for Extracting the Last Character in Each Cell - Please Help!

    Hello,

    I have a list with over 5K+ rows of data. I am trying to extract the very last character from each cell for 3 particular rows. Here is the formula that I tried using; it is giving me the last text/word, and I am at wit's end as to how to fix it:


    =RIGHT(T347, LEN(T347) - FIND("*", SUBSTITUTE(T347, " ", "*", LEN(T347) - LEN(SUBSTITUTE(T347, " ", "")))))

    Any help would be greatly appreciated!

    Wally

  2. #2
    Registered User
    Join Date
    04-06-2012
    Location
    Erode, India
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Right(T347,1)

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Hi and welcome to the forum

    To return the very last character, all you need is =right(T347,1)

    Im not sure how the "3 particular rows" fits inthough?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    deleted my duplicate post

  5. #5
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Thank you!

    I did try that, but it seems that I have hard spaces at the end of the cells, and doing Right(T347,1) alone doesn't capture the last character. Is there a way to get rid of the spaces at the end of each cell and then extract the last character?

    Thank you all once again.

  6. #6
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Thank you!

    I did try that, but it seems that I have hard spaces at the end of the cells, and doing Right(T347,1) alone doesn't capture the last character. Is there a way to get rid of the spaces at the end of each cell and then extract the last character?

    Thank you all once again.

  7. #7
    Registered User
    Join Date
    08-09-2012
    Location
    Kolkata
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Try =RIGHT(TRIM(T347),1)
    Last edited by Sanish Tirkey; 03-18-2013 at 01:36 AM.

  8. #8
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Unfortunately it is not working. I get an error. Also, I sometimes have more than 1 space at the end. Is there a < or > option to fix this?

    Thank you!

  9. #9
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    I'm sorry - it does work, but what if there is more than 1 space? Can I do =RIGHT(TRIM(T347), <>1) or something of the sort?

  10. #10
    Registered User
    Join Date
    08-09-2012
    Location
    Kolkata
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Can you post one data item, so I can check. As TRIM should remove all the leading and trailing spaces in any cell.

  11. #11
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Hi,

    Please see attached. If there is more than 1 space, then the formula doesn't work (check celll D1). Thank you!
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    08-09-2012
    Location
    Kolkata
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Your value at B1 has an "Enter" charater at the end, which is not removed by TRIM. If this is a one time activity you are working on, they can be removed by a custom function. I will try and see if any of the existing excel formulas can do that.

  13. #13
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Thank you! What about the formula I have on top?

    =RIGHT(T347, LEN(T347) - FIND("*", SUBSTITUTE(T347, " ", "*", LEN(T347) - LEN(SUBSTITUTE(T347, " ", "")))))

    If the last word in a cell is "go", it will give me that last text. I don't have any issues with spaces with this function. Is there a way to add to the function so it only gives the last character?
    Last edited by walle786; 03-18-2013 at 02:19 AM.

  14. #14
    Registered User
    Join Date
    08-09-2012
    Location
    Kolkata
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    =RIGHT(TRIM(REPLACE(B1,FIND(CHAR(10),B1,1),1,"")),1)

    Solved . But this will only work with one ENTER character. I would like to see a more dinamic one though.

  15. #15
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    @Sanish Tirkey:
    use SUBSTITUTE instead of REPLACE.
    =RIGHT(TRIM(SUBSTITUTE(B1,CHAR(10),"")))

    and what you mentioned is an ALT + ENTER (a carriage return). not sure if this is what OP wants though. it returns the last bracket.

    @walle786:
    you have to give us a bigger sample & show your desired results to let us know what you roughly need. if you don't want close brackets, then:
    =RIGHT(TRIM(SUBSTITUTE(SUBSTITUTE(B1,CHAR(10),""),")","")))

    but we can't possibly foresee what you are facing. your formula does not retrieve the last character. it retrieves everything after the last space

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  16. #16
    Registered User
    Join Date
    03-18-2013
    Location
    Laurel
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Formula for Extracting the Last Character in Each Cell - Please Help!

    Quote Originally Posted by benishiryo View Post
    @Sanish Tirkey:
    use SUBSTITUTE instead of REPLACE.
    =RIGHT(TRIM(SUBSTITUTE(B1,CHAR(10),"")))

    and what you mentioned is an ALT + ENTER (a carriage return). not sure if this is what OP wants though. it returns the last bracket.

    @walle786:
    you have to give us a bigger sample & show your desired results to let us know what you roughly need. if you don't want close brackets, then:
    =RIGHT(TRIM(SUBSTITUTE(SUBSTITUTE(B1,CHAR(10),""),")","")))

    but we can't possibly foresee what you are facing. your formula does not retrieve the last character. it retrieves everything after the last space

    Hi!

    Sorry for the late reply. I can't show the actual data due to the personal content, but here is a great sample. It encompasses the same issues that I am having - that is, the carriage return (ALT + Enter). I tried the formulas above, and they get close, but I don't always get every character. With 5K rows, I will never catch them manually.

    Also, as a separate question, if you do a VLookup and want the values to be copied over to a new column, how do you do this without inputting data in other cells? I have a filter on so the Vlookup skips hundreds of cells, and when I try to copy and paste the values, it enters them into the incorrect cells.
    Attached Files Attached Files

+ 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