How to remove last/first character if it is a comma or certain character in Excel?
For a range of data, you may want to delete the last or first character if it is a comma or other character in Excel. This article will show you two methods to achieve it.
You can apply the following formulas to delete the last or first character if it is a comma or certain character in Excel.
1. Select a blank cell (says C1) in the help column, enter formula =IF(RIGHT(A1,1)=",",LEFT(A1,LEN(A1)-1),A1) into the Formula Bar, and then press the Enter key.
1. In the formula, A1 is the cell with last character you need to remove, “,” is the comma symbol which belongs to the last character of cell A1. You can change the comma symbol to any other character as you need.
2. You can apply this formula =IF(LEFT(A1,1)=",",RIGHT(A1,LEN(A1)-1),A1) to remove the first character if it is a comma.
2. Keep selecting cell C1, then drag the Fill Handle to the corresponding cells for deleting all last characters if they are met the condition. Then you can see all commas after the specified cells are removed as below screenshot shown.
This section will show you the Select Specific Cells utility and the Delete by Position utility of Kutools for Excel. With these two utilities, you can easily select all cells which end or begin with certain character, and then remove them from the selected cells at once.
1. Select a range of cells you want to find cells end or begin with certain character, then click Kutools > Select > Select Specific Cells. See screenshot:
2. In the Select Specific Cells dialog box, select the Cell option in the Selection type section, and in the Specific type section, choose Ends with or Begins with from the first drop-down list and then type a comma or other character you need into the following textbox, and finally click the OK button.
Note: If you need to select cells with two criteria, for example select all cells which end with comma and cells end with character “n”, please enable these two conditions with selecting the And option, choose Ends with or Begins with from the two drop-down lists, and then type comma mark and the character “n” into the textboxes consecutively.
3. Then a dialog box pops up to tell you how many cells are selected, click the OK button and all qualified cells are selected immediately. Now you need to click Kutools > Text > Remove by Position.
4. In the Remove by Position dialog box, enter number 1 into the Numbers box, select From right to remove the last character or From left to remove the first character in the Position section (here we select the From right option), and then click the OK button.
You can see all last characters of selected cells are removed immediately. See screenshot:
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 1 months agoTo remove a line break which is the last character of a cell, use this formula: IF(RIGHT(A2,1)=CHAR(10),LEFT(A2,LEN(A2)-1),A2)
To post as a guest, your comment is unpublished.· 5 months agomistake in the formula
To post as a guest, your comment is unpublished.· 7 months agoWhy is that every time I try to use KUTOOL , It crashes the application and close out the excel without saving. Its frustrating . Can someone help. It looks like cool tool to use
To post as a guest, your comment is unpublished.· 2 years agoHi, I am trying to remove initials that exist at the end of some names in a list, using this method. My formula is =IF(LEFT(A1,2)=",",RIGHT(A1,LEN(A1)-2),A1) so that John S becomes John. Thanks