How to add a prefix to a column in excel
Tutor 5 (296 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Adding a prefix to a column in Excel allows you to prepend specific text or characters to every cell in a column, which is useful for formatting IDs, phone numbers, or codes.
Using a Formula to Add a Prefix
-
Select a blank column next to your data.
-
Enter the following formula in the first cell of the new column:
= "Prefix" & A1
Replace
"Prefix"with the text you want to add, andA1with the first cell of your target column. -
Press Enter to apply the formula.
-
Drag the fill handle (small square at the bottom-right of the cell) down to apply the formula to the rest of the column.
-
To replace the original column with the prefixed values:
-
Copy the new column with the formulas.
-
Right-click the original column and select Paste Values.
-
Using Flash Fill (Excel 2013 and Later)
-
Type the desired value with the prefix in the first cell of the column.
Example: If your first value is123and your prefix isID-, typeID-123. -
Go to the Data tab and click Flash Fill or press Ctrl + E (Windows) / Command + E (Mac).
-
Excel automatically fills the rest of the column with the prefix added.
Using the Concatenate Function (Alternative)
-
Use the
CONCATENATEfunction: -
Press Enter and drag the formula down to the rest of the cells.
-
Convert formulas to values using Paste Values as described above.
Using VBA for Large Columns
For very large datasets, using a VBA macro is faster:
-
Press Alt + F11 to open the VBA editor (Windows) or Option + F11 (Mac).
-
Click Insert > Module and paste the code:
Sub AddPrefix()
Dim cell As Range
Dim prefix As String
prefix = "ID-"
For Each cell In Selection
If Not IsEmpty(cell) Then
cell.Value = prefix & cell.Value
End If
Next cell
End Sub
-
Select the cells you want to modify.
-
Press Alt + F8, select
AddPrefix, and click Run.
This method adds the prefix directly without needing extra columns.
Notes
-
Flash Fill works only if Excel detects a clear pattern.
-
Formulas allow dynamic changes; modifying the original column updates the results.
-
VBA is best for automation and large datasets exceeding thousands of rows.
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
Why are margins not working
Answers · 1
Why is page layout not working
Answers · 1
How to print repeated rows on top in excel
Answers · 1
How to print header on each page
Answers · 1