Skip to main content

How to add text to the beginning or end of all cells in Excel?

Occasionally, you might find yourself needing to prepend or append the same specific text to every cell within a selection. Doing this manually for each cell can be quite tedious and time-consuming. Fortunately, there are several simpler methods to achieve this, allowing you to add the same text to the start or end of all cells in a selection more efficiently.


Add specified text to the beginning / end of all cells with formulas

In this section, we will learn how to easily insert specific text or characters at the start or end of cells using Excel formulas.

Add specified text to the beginning of cells

To prepend text to the beginning of a cell in Microsoft Excel, you can concatenate a specified string with the cell reference using an Excel formula. Suppose you need to prepend "Class A: " to names in column A. Here's how you can apply a formula to achieve this:

  1. Select a cell where you want to output the first name prefixed with "Class A: ".

  2. Input any of these formulas based on your preference and hit Enter to see the first outcome (Here I will use the first formula as an example):
    ="Class A: "&A2
    =CONCATENATE("Class A: ", A2)
    =CONCAT("Class A: ", A2)
    Tip: In these formulas, "Class A: " is the prefix added to names, and A2 is the first cell containing a name you wish to modify. Feel free to substitute "Class A: " and adjust A2 to suit your specific needs.

  3. Drag the fill handle down to the cells you want to apply this formula.

Notes:

  • The formulas will not modify the original data.
  • For simplicity, place the text you wish to add into a specific cell (such as E2) and then combine the two cells. Tip: The cell address for the prepended text is locked with the $ sign to prevent changing when copying the formula down.


Add specified text to the end of cells

To append text to the end of a cell in Microsoft Excel, you can concatenate the cell reference with a specified string using an Excel formula. Imagine you need to append " - Class A" to names in column A. Follow these steps to utilize a formula effectively:

  1. Select a cell where you want the name suffixed with " - Class A" to be displayed.

  2. Choose one of these formulas according to your preference and press Enter to view the outcome (Here, I will demonstrate using the first formula):
    =A2&" - Class A"
    =CONCATENATE(A2, " - Class A")
    =CONCAT(A2, " - Class A")
    Tip: In these formulas, " - Class A" is the text appended to names, and A2 refers to the initial cell containing a name you aim to modify. You're encouraged to replace " - Class A" and adjust A2 as needed to meet your specific requirements.

  3. Extend the formula to the desired cells by dragging the fill handle downwards.

Notes:

  • The formulas will not modify the original data.
  • For simplicity, place the text you wish to add into a specific cell (such as E2) and then combine the two cells. Tip: The cell address for the prepended text is locked with the $ sign to prevent changing when copying the formula down.


Add same text to a specific location of each cell in Excel

How could you add text or characters to the beginning of multiple cells, or add text or characters to the end of cells or insert text or characters between existing text? With Add Text utility of Kutools for Excel, you can quickly apply the following operations: . Click for full-featured free trial in 30 days!
doc add text 6
 
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in full future 30 days.

Add specified text to the beginning / end of all cells with VBA

In this section, we'll explore a straightforward VBA method to add specified text directly to the beginning or end of all cells within one or multiple selected ranges.

Add specified text to the beginning of cells
  1. Select the range(s) where you will add the specified text to the beginning of all cells.
  2. Hold down the Alt + F11 keys in Excel to open the Microsoft Visual Basic for Applications window.
  3. Click Insert > Module, and paste the following VBA code in the Module window.
    Sub PrependToSelectedCells()
        Dim c As Range
        For Each c In Selection
            If c.Value <> "" Then c.Value = "EXCL-" & c.Value 
        Next
    End Sub

    Note: This code prefixes all selected cells with "EXCL-". Ensure you replace this sample text in the code with the actual text you require before applying it to your worksheet.

  4. Press the F5 key to run this macro.

Result

The value "EXCL-" will be prepended to the contents of all selected cells.

Tip: If you'd like to place the modified values into the right adjacent column rather than adding text directly to the beginning of the original values, use the code below:

Sub PrependToRightOfSelectedCells()
    Dim c As Range
    For Each c In Selection
        If c.Value <> "" Then c.Offset(0, 1).Value = "EXCL-" & c.Value
    Next c
End Sub

Add specified text to the end of cells
  1. Select the range(s) where you will add the specified text to the end of all cells.
  2. Hold down the Alt + F11 keys in Excel to open the Microsoft Visual Basic for Applications window.
  3. Click Insert > Module, and paste the following VBA code in the Module window.
    Sub AppendToSelectedCells()
        Dim c As Range
        For Each c In Selection
            If c.Value <> "" Then c.Value = c.Value & "-XS"
        Next
    End Sub

    Note: This macro appends "-XS" to the content of each selected cell. Make sure to replace "-XS" with the specific suffix you wish to append to your cell contents before running the macro in your worksheet.

  4. Press the F5 key to run this macro.

Result

The value "-XS" will be appended to the contents of all selected cells.

Tip: If you'd like to place the modified values into the right adjacent column rather than adding text directly to the end of the original values, use the code below:

Sub AppendToRightOfSelectedCells()
    Dim c As Range
    For Each c In Selection
        If c.Value <> "" Then c.Offset(0, 1).Value = c.Value & "-XS"
    Next c
End Sub

Add specified text to the beginning / end of all cells with Kutools for Excel

Kutools for Excel's Add Text tool will help you quickly add specified text to the beginning or end of each cell in a selection.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1. Select the range in which you will add specified text.

2. Click the Kutools > Text > Add Text…. See screenshot:

doc add specific text 11

3. In Add Text dialog box, enter the text you need to add in the Text box.

(1.) If you check Before first character from the Position section, and the specific text will be added in front of all the cell values.

doc add specific text 6

(2.) If you check After last character from the Position section, and the specific text will be added at the end of the cell values.

doc add specific text 7

Notes:

1. Kutools for Excel's Add Text tool allows you to preview the changes in selection in Preview section.

2. If you check the Skip non-text cells option, this tool won't add the specified text in cells with non-text content.


Add specified text to the specified position of all cells with Kutools for Excel

Applying Kutools for Excel's Add Text function, you can not only add the specified text to the beginning or end of the cells, but also you can add the specified text to the specified position of the cells.

After installing Kutools for Excel, please do as below:(Free Download Kutools for Excel Now!)

1. Select a range you want to add text to, and then click Kutools > Text > Add Text.

2. The Add Text dialog will be displayed, and enter the specified text and specify the certain position which you want to insert the text in the boxes. See screenshot:

Here I type 3 into the Specify textbox means that add text after the third character of the string.

doc add specific text 8

3. Click Ok or Apply. The specified text has been added to the specified position of the cells. See screenshot:

doc add specific text 9

Tip:

(1) In Specify textbox, you can type numbers with comma separate to add text in multiple position at the same time.
doc add specific text 12

(2)If you want to add text before every uppercase letter, the 1st letter is uppercase option in Add Text utility can help you.
doc add specific text 10

Also, you can add text before every lowercase letter, or every number letter.

Click Download and free trial Kutools for Excel Now !


Demo: Add text to the beginning or end of all cells


Relative articles:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

Comments (55)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour, J'ai besoin d'aide. J'ai un tableau excel dans lequel je veux dans une de mes colonnes que lorsque j'écris NOK la cellule se colore en rouge et les caractères en blanc.
En VBA J'ai déjà tout essayé comme message mais j'ai toujours une erreur. Mon problème se situe au niveau de la première ligne car je ne sais pas quoi écrire. Quand j'inscris NAME il ne fait rien. Quand j'inscris Value il ne fait rien. J'ai essayé TEXTBOX et le nom de la colonne CAISSE mais j'ai toujours une erreur.

If cell.Textboxcaisse = NOK Then
cell.Interior.ColorIndex = 3
cell.Font.ColorIndex = 2
cell.Font.Bold = True
End If
Next
For Each cell In Range("r3:r500")
If cell.Name = OK Then
cell.Interior.ColorIndex = 2
cell.Font.ColorIndex = 1
cell.Font.Bold = True
End If
Next

Merci pour votre aide.
This comment was minimized by the moderator on the site
Hi there,

Do you mean that you want the fill color to turn red and font color to turn white as long as the cell's content is NOK? So, if 10 cells have NOK as content, and the 10 cells are in the column you mentioned, the fill color and font color of all the 10 cells will change?

Also, can you speak English? So I can better understnd your situation. And it will be better if you attach the file with the VBA you created. So that we can help you revise it with higher efficiency.

Thanks in advance.
Amanda
This comment was minimized by the moderator on the site
Thank you!
This comment was minimized by the moderator on the site
the VBA code worked perfectly on Office for Mac
This comment was minimized by the moderator on the site
Me has quitado varias horas de trabajo de encima, mil gracias!!!
This comment was minimized by the moderator on the site
thanks a lot dear for sharing information.
This comment was minimized by the moderator on the site
Thank you! Apend and pre-pend macro works great
This comment was minimized by the moderator on the site
I am trying to change a date formula from mm/dd/yyyy to dd/mm/yyyy. The leading zeros for months and dates less than 10 (two digits) are going away. Anyone have tips on how to easily put them back. I tried using the =month, =day, =year formulas and concatenating them. However, the leading zeros are dropping off. I would manually have to put in the leading zeros. Is there an easy way to do this? We are going to have approximately 1,000 rows of data on our file each month.
This comment was minimized by the moderator on the site
Hi, Amanda, if you want to convert date from mm/dd/yyyy to dd/mm/yyyy, this article https://www.extendoffice.com/documents/excel/4646-excel-convert-dd-mm-yyyy-to-mm-dd-yyyy.html can help you, it list two easiest ways for solving this job.
This comment was minimized by the moderator on the site
I want to make a formula that show in cell text "Profit" when another cell show +digit, and show in that cell "Loss" when another that cell show -digit
This comment was minimized by the moderator on the site
Hi, Manik, use this =IF(B1>0, "Profit", "Loss")
This comment was minimized by the moderator on the site
Thanks a lot!! I was initially using Access but this is so much easier.
This comment was minimized by the moderator on the site
Hello, i want to add text in a formula;

current cell value: ='DAM91-SVC'!$C$47
i want to add text: [MHSV Sales Report 2017 (JAN-DEC).xlsx]

therefore the cell value should read like this in the end: ='[MHSV Sales Report 2017 (JAN-DEC).xlsx]DAM91-SVC'!$C$47

please tell me how will this be done.
thank you
total 1800 cell count need alteration.
This comment was minimized by the moderator on the site
Hello, sorry to read your question so late. Here is a solution but you need to free download Kutools for Excel.

Using the Convert Formula to Text utility to convert the formula cell to text, then apply Add Text utility to add the text string in the Specify position(1), then click Ok. After all cells have been added text, conver them to formula by click Kutools > Content > Convert Text to Formula.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations