How to remove certain characters from end of string IF
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How do I remove certain characters from a string if and only if they are that character? For example:
I have a column with NAICs 3 Digit Titles that have a "T" inserted at the end of some cells but not all. How do I remove the "T" from ONLY the end of the string IF and ONLY if it is a "T"? To clarify, If there is not a "T" at the end of the string I want the string to remain the same. Also, I do not want to replace every "T" just the ones at the end of the string.
NAICs 3 Digit Title
Professional, Scientific, and Technical ServicesT
Social AssistanceT
Sporting Goods, Hobby, Musical Instrument, and Book Stores
Real EstateT
Food Services and Drinking PlacesT
Specialty Trade ContractorsT
Merchant Wholesalers, Nondurable Goods
Furniture and Home Furnishings Stores
Real EstateT
Solved! Go to Solution.
- Labels:
- Expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for the reply. Both of the following expressions worked except for all entries with "Professional, Scientific, and Technical ServicesT ", for cells with this string it left the T at the end::
If Right([NAICs 3 Digit Title],1) = "T" then
Substring([NAICs 3 Digit Title],0,Length([NAICs 3 Digit Title])-1)
else
[NAICs 3 Digit Title]
Endif
TrimRight([NAICs 3 Digit Title],'T')
I am not sure why it removed the "T" from all the other values except for this particular entry. Any idea what I am doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is how the Formula tool should be setup with "NAICs 3 Digit Title" being the field you modify. And you see with the Data Preview your value "Professional, Scientific, and Technical ServicesT" is changed to "Professional, Scientific, and Technical Services"
Here is how Formula tool should be placed in your workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you! It works well!
