Excel: How to remove last 4 characters

Sometimes you may get data attached to some other data that you don't require. Luckily, Excel allows you to get rid of the extra characters. In this tutorial, we are going to look at how you can eliminate the last 4 characters.

Apart from removing the last characters, you can also remove the first characters that you do not need. That is the characters on your left or right. The best thing about all this is that you can remove these characters using a simple formula/ function or using software known as KUTOOLs.

Using the left function

If you are removing the last characters the left function is the most appropriate to use. Conversely, you can use the right Function to remove the first characters from the beginning of a text string.

Steps

1. Open your spreadsheet

2. Enter the following formula in an empty cell =LEFT(A1, LEN(A1)-4)

3. Press enter and the characters will be removed

4. Right Click and drag the green rectangle to the rest of the cells

In the example above we have removed the last four characters. This formula can be used to remove as many characters as you want. Just replace 4 with the number of characters that you want to eliminate.

Using VBA code for a user-defined function

Another easy way that you can remove both the first and last characters is by using the user-defined function.

Steps

1. Press Alt+F11 to open the window for Microsoft Visual Basic

2. Click insert module

3. Copy and paste the code below to the script editor

  Sub Remove_Last_Character()
On Error GoTo Message
Dim n As Integer
n = Int(InputBox("Enter the Number of Last Characters to Remove: "))
For i = 1 To Selection.Rows.Count
For j = 1 To Selection.Columns.Count
Selection.Cells(i, j) = Left(Selection.Cells(i, j), Len(Selection.Cells(i, j)) – n)
Next j
Next i
Exit Sub
Message:
MsgBox "Please Enter a Valid Integer Less than or Equal to the Length of the Strings."
End Sub

4. save the code and return it to your spreadsheet

5. Highlight your data Press ALT+F8

6. Select the Remove_Last_Character Macro and click run

7. Enter 4 as the number of characters you wish to remove and click okay.

8. All the last four columns will be removed

The above two methods are very easy and they work with all versions of excel.

Use KUTOOLS software to remove the last 4 characters

Download KUTOOLS here and install it on your computer. This is will appear as a tab on your Excel and you can use it to simplify so many processes and manage your documents painlessly. Besides, it is a very small file of 48 MBS. Installation is easy and it does not upload any data or obtain any useful information.

Steps for removing the last 4 characters using KUTOOLS

1. Download and install KUTOOLS

2. Restart your Excel app

3. Click on Kutools >>Text and select remove by position

4. Enter the number of characters that you want to remove in the pop-up box that will appear.

5. Select the position that you want, i.e. right or left, and click apply.

6. The last four digits will be removed

You can also select as many cells as you can and eliminate the characters using kutools. Keep it as you are going to use it a lot as you work with Excel. I highly recommend using kutools as it is easy to install and use.

%d bloggers like this: