Trim Function for Other Characters

CPGDeveloper

Board Regular
Joined
Oct 8, 2008
Messages
189
I know the Trim Function will remove leading and trailing blank spaces, but is there any similar function that will remove leading and trailing characters of my choosing? For example, if I want to remove leading or trailing commas, periods, dashes, etc...
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Well, there is the Replace function, but that would replace all instances that it finds, not just the trailing ones.

I would recommend creating your own User Defined Function to do something like what you want.
 
Upvote 0
Did you ever get help on how to do this?
I have the same situation and could really use some help. Thank you
 
Upvote 0
@iamkennyj

Perhaps if you give a few examples together with expected results we may be able to help.

Regards
 
Upvote 0
Did you ever get help on how to do this?
I have the same situation and could really use some help. Thank you
Can you provide some more details and examples of exactly what you are trying to do?
 
Upvote 0
@iamkennyj

Perhaps if you give a few examples together with expected results we may be able to help.

Regards

I have the a text field with 65.49- in it to represent negative $65.49. I want to remove the trailing - and make it a negative number field
 
Upvote 0
Try this:
Code:
IIF(Right([MyValue],1)="-",0-Left([MyValue],Len([MyValue])-1),0+[MyValue])
where "MyValue" is your field name.
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,419
Members
451,765
Latest member
craigvan888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top