A ACarella Oct 28, 2008 #1 How do I remove trailing spaces and periods at the end of a phrase in Excel?
A AltaEgo Oct 28, 2008 #2 The Trim() function will clean up both leading and trailing spaces: Example Trim(A1) will turn "cat " (without quotes) into "cat". To use it to clean up your data: 1) Insert your formula in the first vacant column. 2) Copy down. 3) Copy the result 4) Over the original bad values, Edit/ Paste Special/ Values The following custom function will trim trailing blanks only: Function RightTrim(c As Range) RightTrim = RTrim(c) End Function To use the above you would need to create a macro: a) Follow the steps under "Create a macro using Microsoft Visual Basic" on the following page http://office.microsoft.com/en-us/excel/HP052047111033.aspx Copy and paste the above three lines of codes at step (3) b) After doing this, enter it the same way as any inbuilt function. Example =RightTrim(A1)
The Trim() function will clean up both leading and trailing spaces: Example Trim(A1) will turn "cat " (without quotes) into "cat". To use it to clean up your data: 1) Insert your formula in the first vacant column. 2) Copy down. 3) Copy the result 4) Over the original bad values, Edit/ Paste Special/ Values The following custom function will trim trailing blanks only: Function RightTrim(c As Range) RightTrim = RTrim(c) End Function To use the above you would need to create a macro: a) Follow the steps under "Create a macro using Microsoft Visual Basic" on the following page http://office.microsoft.com/en-us/excel/HP052047111033.aspx Copy and paste the above three lines of codes at step (3) b) After doing this, enter it the same way as any inbuilt function. Example =RightTrim(A1)
S ShaneDevenshire Oct 29, 2008 #3 Hi, This removes the trailing spaces and period at the end of a cell's contents: =LEFT(TRIM(C8),LEN(TRIM(C8))-1)
Hi, This removes the trailing spaces and period at the end of a cell's contents: =LEFT(TRIM(C8),LEN(TRIM(C8))-1)
A ACarella Oct 29, 2008 #4 Thank you for your response.... I have three scenarios. Extinguish all ignition sources. Avoid sparks, flames, heat and smoking. Ventilate. (In this case it should remove the period after Ventilate) Provide ventilation and confine spill. Do not allow runoff to sewer. (In this case it should remove the period after sewer) Keep away from ... (incompatible materials to be indicated by the manufacturer) (In this case ... is a variable and should be replaced with .?) Can you help?
Thank you for your response.... I have three scenarios. Extinguish all ignition sources. Avoid sparks, flames, heat and smoking. Ventilate. (In this case it should remove the period after Ventilate) Provide ventilation and confine spill. Do not allow runoff to sewer. (In this case it should remove the period after sewer) Keep away from ... (incompatible materials to be indicated by the manufacturer) (In this case ... is a variable and should be replaced with .?) Can you help?