How to add text to the beginning or end of all cells in Excel?
Sometimes you may need to add same specific text to the beginning or end of all cells in a selection. If you added the text to each cell manually one by one, it must be time-consuming. Are there easier ways? Yes, there are many easy tricks to add same text to the beginning or end of all cells in a selection.
Office Tab: Enable Tabbed Editing and Browsing in Office, Just Like Chrome, Firefox, IE 8/9/10. Read more...
Classic Menu for Office: Bring Classic Menus and Toolbars of Office 2003/XP/2000 Back to Office 2007, 2010 and 2013. Read more...
Suppose you have a name roll as following screenshot shows, and the follow methods will guide you add specified text at the beginning and end of each cell in A1:C5.
There are two formulas to add specified text to the beginning or end of all selected cells in Microsoft Excel.
Method 1: & formula
Enter the ="Class A: "&A1 in Cell E1, and copy this formula to other cells with dragging the bottom right corner of the Cell E1.
Method 2: Concatenate formula
Enter the =Concatenate ("Class A: ", A1) in Cell E1, and copy this formula to other cells with with dragging the bottom right corner of the Cell E1.
1. If you want to add specified text in each cell, just replace the Class A: with your text in both formulas.
2. The formulas of =A1 & "Class A: " and =Concatenate (A1, "Class A: ") will add Class A: at the end of Cell A1.
3. Both formulas will not modify the contents in selection directly.
If you want to add specified text in each cells of a selection directly, the following VBA Macro will ease your work.
Step 1: Select the range in which you will add specified text;
Step 2: Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.
Step 3: Click Insert > Module, and paste the following VBA code in the Module Window.
VBA for adding specified text at the beginning of each cell
Dim c As Range
For Each c In Selection
If c.Value <> "" Then c.Value = "LSB " & c.Value
VBA for adding specified text at the end of each cell
Dim c as range
For each c in Selection
If c.value <> "" Then c.value = c.value & " LSB"
you can change the variable "LSB" of the above codeas.
Step 4: Press the F5 key to run this macro. And all of the cells will be added the value LSB before or after the cell contents.
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 includes more than 120 handy Excel tools. Free to try with no limitation in 30 days. Get it Now.
Step 1: Select the range in which you will add specified text.
Step 2: Click the Kutools > Text Tools > Add Text…. See screenshot:
Step 3: In Add Text dialog box, enter the specified text in the Text box, and check the right option in Position section, such as Before first character, After last character, etc.
Step 4: Click OK or Apply. The specified value will be added before or after the cell contents. See screenshots:
|Add the specific text before the cell contents|
|Add the specific text after the cell contents|
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.