Monday, December 24, 2012

How to Remove Trailing Commas in Excel


1. Open the worksheet that contains the data from which you want to remove trailing commas.
2. Right-click the header of the column directly to the right of the data column that you want to clean. Click 'Insert' in the menu to insert a new function column.
3. Type the following in the cell in the formula column adjacent to the first data cell:=IF(RIGHT(A1,1)=',',LEFT(A1,LEN(A1)-1),A1)Substitute the cell address of your first data cell in place of all instances of 'A1' in the above example.
4. Press 'Enter.' Excel first determines whether the rightmost value in the data cell is a comma. If so, it determines the number of characters in the cell using the 'Len' function and then returns only the leftmost N minus 1 characters, thus omitting the comma. If no comma is detected at the end of the string, then Excel returns the original cell value.
5. Right-click the formula cell and click 'Copy.' Paste the formula into the cell directly to the right of all cells from which you want to clean the commas. Excel will perform the comma-trimming function on all cells and return the update value in the formula column.
6. Highlight all formula cells, then right-click the array and choose 'Copy.'
7. Highlight the original data cells, then right-click the array and choose 'Paste Special.' Click the radio button next to 'Values,' then click the 'OK' button. Excel will copy the output strings from the comma-less formula cells into your original data cells as static character strings.
8. Highlight the formula column, then right-click the array and click 'Delete' from the menu. This will delete the formula column now that a permanent copy of the formula output has been saved in the original data column.

Blogger news