Consider a situation where you have a dataset containing raw data, where the first 3 characters are unnecessary and need to be removed.
Method 1 – Using RIGHT Function
The combination of RIGHT function and LEN function can remove the first 3 characters from your cells.
Steps:
- In cell C4, apply the RIGHT function nested with the LEN function. The formula is:
=RIGHT(B4,LEN(B4)-3)
The string_cell argument in the function (from where we will remove 3 characters) is B4.
LEN(B4)-3 is used as the num_chars, and will remove the first 3 characters from the cell.
- Press ENTER to return the result.
- Move your mouse cursor to the bottom right corner of your cell. When the cursor shows the cross sign, double-click on the Fill Handle to apply the same function to the rest of the cells.
Read More: How to Remove First Character in Excel
Method 2 – Using REPLACE Function
The REPLACE function replaces part of a text string with a different text string. Here, we will utilize this function to remove characters from cells by replacing text with nothing.
Steps:
- Enterthe following REPLACE function in cell C4:
=REPLACE(B4,1,3,"")
B4 is the Old_text to be replaced.
Start_num is 1, as will start from the beginning of the text.
Num_chars is 3, as we want to replace the first three characters.
New_text is the modified text that will replace the old text, namely nothing (“”).
- Press ENTER to get the result.
- Use the Fill Handle as in Method 1 to copy the same formula to the other cells in the column.
Read More: How to Remove the Last 3 Characters in Excel
Method 3 – Using MID Function
The combination of the MID function and the LEN function performs the same operation as Method 1.
Steps:
- Enter the following formula in cell C4:
=MID(B4,4,LEN(B4)-3)
Here text is B4.
Start_num is 4, as we will remove the first 3 numbers.
Num_chars is defined as LEN(B4)-3)
- Press ENTER.
- Use the Fill Handle to apply the formula to all cells.
Method 4 – Using VBA to Create a User Defined Function
You can also define a custom function to do the job using VBA code.
Steps:
- Open the Microsoft Visual Basic for Applications Window by pressing Alt+F11.
- A new window is opened. In it, click Insert then select Module to open a new module.
- In the newly opened module, enter the following VBA code to make a UFD (user-defined function) to remove the first 3 characters from your cells:
Public Function RemoveFirst3(rng As String, cnt As Long)
RemoveFirst3 = Right(rng, Len(rng) - cnt)
End Function
- Save the code.
- Go back to the worksheet and in cell C4 start typing =RemoveFirst3 to check our UDF has been created successfully.
- Enter the following function in cell C4:
=RemoveFirst3(B4,3)
- Press ENTER to return the result.
- Use the Fill Handle to apply this function to the rest of the cells.
Read More: How to Remove the First Character from a String in Excel with VBA?
Things to Remember
Creating a custom formula has more limitations than regular VBA macros, as it cannot alter the structure or format of a worksheet or cell.
Applying the UFD, you can remove any number of characters from your cells.
Download Practice Workbook
Related Articles
- How to Remove Last Character in Excel
- How to Remove Last Digit in Excel
- How to Remove Last Character from String Using VBA in Excel
<< Go Back To Excel Remove Characters From Left | Excel Remove Characters | Data Cleaning in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!