Add character to the end of a string
Results 1 to 5 of 5

Thread: Add character to the end of a string
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Add character to the end of a string

    What formula do I use to add a character to the end of a cell if that character is not already there?

    Example: there are multiple rows... some end in "NC" and some end in "N". I'm using the quotation marks to designate that the cells end in the letters. The quotation marks are not in the cells. The cells are of varying lengths. If a cell ends in "NC", then nothing needs to be done. If a cell ends in "N", how do you add a "C" to it to make it "NC"?

  2. #2
    Board Regular
    Join Date
    Jun 2014
    Location
    Oakland, CA
    Posts
    5,146
    Post Thanks / Like
    Mentioned
    42 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Add character to the end of a string

    Hi,

    Does this help:

    AB
    1abcNCabcNC
    2DEFghNDEFghNC
    3xyzqwertyNCxyzqwertyNC
    4dfg Ndfg NC
    5klrlmo NCklrlmo NC
    6abc def ghi jkl Nabc def ghi jkl NC

    Sheet691



    Worksheet Formulas
    CellFormula
    B1=SUBSTITUTE(A1,IF(RIGHT(A1)="N","N",""),"NC")


  3. #3
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    16,056
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    7 Thread(s)

    Default Re: Add character to the end of a string

    Try something like this...

    =IF(A1="","",IF(RIGHT(A1,2)="NC",A1,A1&"C"))
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    How to post your vba code
    [CODE]your VBA code here[/CODE]
    The # button in the forum's editor will apply CODE tags around your selected text.

  4. #4
    New Member
    Join Date
    Jul 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Add character to the end of a string

    That worked!

    Thank you

  5. #5
    MrExcel MVP Rick Rothstein's Avatar
    Join Date
    Apr 2011
    Location
    New Jersey, USA
    Posts
    35,099
    Post Thanks / Like
    Mentioned
    92 Post(s)
    Tagged
    33 Thread(s)

    Default Re: Add character to the end of a string

    Quote Originally Posted by tad_excel_74 View Post
    Example: there are multiple rows... some end in "NC" and some end in "N".
    Do any of the cells end in anything else besides "N" or "NC"?

    Could any of the cells within the data area be blank?
    Rick's "mini" blog... http://www.excelfox.com/forum/f22/
    .
    Want to post a small screen shot? See Part B here.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •