Add character to the end of a string

tad_excel_74

New Member
Joined
Jul 17, 2019
Messages
3
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"?
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
5,146
Hi,

Does this help:

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style=";">abcNC</td><td style=";">abcNC</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">2</td><td style=";">DEFghN</td><td style=";">DEFghNC</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">3</td><td style=";">xyzqwertyNC</td><td style=";">xyzqwertyNC</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">4</td><td style=";">dfg N</td><td style=";">dfg NC</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">5</td><td style=";">klrlmo NC</td><td style=";">klrlmo NC</td></tr><tr ><td style="color: rgb(22,17,32);text-align: center;">6</td><td style=";">abc def ghi jkl N</td><td style=";">abc def ghi jkl NC</td></tr></tbody></table><p style="width:6.4em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet691</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">B1</th><td style="text-align:left">=SUBSTITUTE(<font color="Blue">A1,IF(<font color="Red">RIGHT(<font color="Green">A1</font>)="N","N",""</font>),"NC"</font>)</td></tr></tbody></table></td></tr></table><br />
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,267
Try something like this...

=IF(A1="","",IF(RIGHT(A1,2)="NC",A1,A1&"C"))
 

Watch MrExcel Video

Forum statistics

Threads
1,102,714
Messages
5,488,471
Members
407,639
Latest member
Carlos Ottoni

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top