Insert Character or Text to Cells

,

This post will guide you how to insert character or text in middle of cells in Excel. How do I add text string or character to each cell of a column or range with a formula in Excel. How to add text to the beginning of all selected cells in Excel. How to add character after the first character of cells in Excel.

Assuming that you have a list of data in range B1:B5 that contain string values and you want to add one character “E” after the first character of string in Cells. You can refer to the following two methods.

1. Insert Character or Text to Cells with a Formula

To insert the character to cells in Excel, you can use a formula based on the LEFT function and the MID function. Like this:

=LEFT(B1,1) & "E" & MID(B1,2,299)

Type this formula into a blank cell, such as: Cell C1, and press Enter key. And then drag the AutoFill Handle down to other cells to apply this formula.

insert text to cells1

This formula will inert the character “E” after the first character of string in Cells. And if you want to insert the character or text string after the second or third or N position of the string in Cells, you just need to replace the number 1 in Left function and the number 2 in MID function as 2 and 3. Like below:

=LEFT(B1,2) & "E" & MID(B1,3,299)
insert text to cells2

2. Insert Character or Text to Cells with VBA

You can also use an Excel VBA Macro to insert one character or text after the first position of the text string in Cells. Just do the following steps:

Step1: open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.

Get the position of the nth using excel vba1

Step2: then the “Visual Basic Editor” window will appear.

Step3: click “Insert” ->”Module” to create a new module.

convert column number to letter3

Step4: paste the below VBA code into the code window. Then clicking “Save” button.

insert text to cells3
Sub AddCharToCells()
    Dim cel As Range
    Dim curR As Range
    Set curR = Application.Selection
    Set curR = Application.InputBox("select one Range that you want to insert one 
    character", "add character to cells", curR.Address, Type: = 8)
    For Each cel In curR
        cel.Value = VBA.Left(cel.Value, 1) & "E" & VBA.Mid(cel.Value, 2, 
        VBA.Len(cel.Value) - 1)
    Next
End Sub

Step5: back to the current worksheet, then run the above excel macro. Click Run button.

insert text to cells4

Step6: select one Range that you want to insert one character.
insert text to cells5

Step7: lets see the result.

insert text to cells6

3. Video: Insert Character or Text to Cells

This video will demonstrate how to insert character or text in middle of cells in Excel using both formulas and VBA code.

4. Related Functions

  • Excel MID function
    The Excel MID function returns a substring from a text string at the position that you specify.The syntax of the MID function is as below:= MID (text, start_num, num_chars)…
  • Excel LEFT function
    The Excel LEFT function returns a substring (a specified number of the characters) from a text string, starting from the leftmost character.The LEFT function is a build-in function in Microsoft Excel and it is categorized as a Text Function.The syntax of the LEFT function is as below:= LEFT(text,[num_chars])…

Leave a Reply