Suffix and Prefix in Excel: A Complete Guide: 5 Methods

Method 1 – Using Ampersand Operator

  • Add prefix, select cell D5 write this formula, and press Enter.
=B5&" "&C5
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Add prefix using ampersand operator

  • To add a suffix, select cell G5, write this formula, and press Enter.
=D5&","&F5
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Add suffix using ampersand operator


Method 2 – Applying CONCATENATE Function

=CONCATENATE(B5," ",C5)
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Add prefix using CONCATENATE function

  • Add suffix, insert the formula in cell G5 based on the CONCATENATE function and press Enter.
=CONCATENATE(D5,",",F5)
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Add sufffix using CONCATENATE function

 


Method 3 – Utilizing Format Cells

  • Select range C5:C9 and press Ctrl + 1 to enter Format Cells dialogue box.

Select range to add prefix

  • In the Number tab, select Custom from the Category list.
  • In the Type input box write your desired formatting style. As our prefix is Dr. , we used this formatting.
"Dr." @

Typing desired prefix to format cell

  • Click OK to apply the formatting.

Dataset with prefix

  • Add suffix, select range D5:D9 and press Ctrl + 1 to enter Format Cells dialogue box.

Select range to add suffix

  • In the Number tab, select Custom from the Category list.
  • In the Type input box write your desired formatting style. As our suffix is PHD.
@,"PHD"

Type desired suffix to format cell

  • Click OK to apply the formatting.

Dataset with suffix


Method 4 – Using Excel Power Query

  • Select range B4:B9.
  • Go to Data tab and from Get & Transform Data group, choose From Table/Range.

Turning range into table

  • Check My table has headers and press OK.

Check Table information

  • Power Query Editor window will open up.
  • In the Transform tab, select Format from Text Column group.
  • Select Add Prefix.

Power Query Editor to add prefix

  • In the Prefix window, type Dr. and press OK.

Type prefix in value box

  • You can see, the prefix has been added to our table.
  • Go to Transform tab to add suffix.
  • From Text Column group, select Format drop-down menu.
  • Select Add Suffix.

Power Query Editor to add suffix

  • In the Suffix window, type ,PHD and press OK.

Type suffix in value box

  • See the prefix has been added to our table.
  • Go to Home tab, from Close & Load drop-down menu, and select Close & Load To.

Close Power Query and Load data

  • In the Import Data window, choose Existing worksheet and select the cell reference to import data.
  • Press OK to exit.

Insert data destination to load

The data with prefixes and suffixes have been generated.

Data with prefix and suffix


Method 5 – Apply VBA Macro to Add Prefix and Suffix

  • We will add prefixes and suffixes to this dataset.

Dataset to apply VBA macro

  • Access the Visual Basic Editor by pressing Alt + F11 on your keyboard.
  • Create a Module in the Visual Basic Editor from the Insert tab.

Insert module to write code

  • Write this code in the module to add prefixes.
Sub AddPrefix()
    Dim rng As Range
    Dim i As Range
    
    Set rng = Range("B5:B9")
    
    For Each i In rng
        i.Offset(0, 1).Value = "Dr. " & i.Value
    Next i
End Sub
  • Press F5 or go to Run tab, and from the drop-down menu, click Run Sub/Userform to execute the code.

Code to add prefix

The prefixes have been added.

Added prefixes using VBA macro

  • Create another module from Insert tab.
  • Write this code in the module to add suffixes.
Sub AddSuffix()
    Dim rng As Range
    Dim i As Range
    
    Set rng = Range("B5:B9")
    
    For Each i In rng
        i.Offset(0, 2).Value = i.Value & ",PHD"
    Next i
End Sub
  • Press F5 or go to Run tab, and from the drop-down menu, click Run Sub/Userform to execute the code.

VBA Code to add suffix

The suffixes have been added.

Added suffixes using VBA macro


How to Add Both Suffix and Prefix in Excel

  • Add both prefix and suffix together, insert the formula in cell E5 based on the CONCATENATE function and press Enter.
=CONCATENATE(B5," ",C5,",",D5)
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Add both suffix and prefix using CONCATENATE function


How to Add 0 as Prefix in Excel

1. By Formatting Data as Text

  • Select range C5:C9 and go to Home tab.
  • In the Number group, from the drop-down menu select Text.

Select format of range as Text

  • Write your numbers with 0 as prefix, the cells will show 0 in the front.

Add 0 as prefix by Text formatting


2. Using TEXT Function

=TEXT(B5,"000000000000")
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Add 0 as prefix using TEXT function


How to Remove Suffix and Prefix in Excel

  • Select cell C5 to write this formula using the RIGHT and LEN functions and press Enter.
=RIGHT(B5,LEN(B5)-4)
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Remove prefix using RIGHT and LEN functions

  • Select cell C5 to write this formula using the LEFT and LEN functions and press Enter.
=LEFT(C5,LEN(C5)-4)
  • Use Fill Handle (+) to apply the formula to the rest of the rows.

Remove suffix using LEFT and LEN functions


Frequently Asked Questions

1. Is there a way to automatically add a suffix to all values in a column when a condition is met in Excel?

Ans: Yes, you can use the IF function in combination with CONCATENATE or ampersand (&) operator to automatically add a suffix to all values in a column when a condition is met in Excel. For example, if the condition is met in cell A1 and you want to add the suffix “_suffix” to column B, you can use the formula.

=IF(A1=condition, B1&"_suffix", B1)

2. How do I add a prefix or suffix to the contents of merged cells in Excel?

Ans: In Excel, you cannot directly add a prefix or suffix to the contents of merged cells. However, you can achieve this by unmerging the cells, applying the prefix or suffix to each individual cell, and then re-merging them.

  • Unmerge the cells by selecting them. Then, right-click and choose Format Cells.
  • Navigate to the Alignment tab, and uncheck Merge cells.
  • Apply the prefix or suffix, and finally, merge the cells again.

3. Can I automatically update the prefix or suffix in Excel when the value in another cell changes?

Ans: No, the prefix or suffix in Excel does not automatically update when the value in another cell changes. Prefixes and Suffixes are static and do not have a built-in mechanism to dynamically update based on changes in other cells. To update the prefix or suffix, you would need to manually modify the formula or use VBA macros to automate the process.


Suffix and Prefix in Excel: Knowledge Hub


Download Practice Workbook

Download this file to practice with the article.


<< Go Back to Text Formatting | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mehedi Hassan
Mehedi Hassan

Mehedi Hassan, having earned a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, functions as an Excel & VBA Content Developer at ExcelDemy. His deep interest in research and innovation aligns seamlessly with his fervor for Excel. In this role, Mehedi not only skillfully addresses challenging issues but also exhibits enthusiasm and expertise in gracefully navigating intricate situations, emphasizing his unwavering dedication to consistently delivering outstanding content. His interests are Advanced... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo