Hi,
How do I get from: 1234567890
To: 456
?
Thanks in advance.
Right(Left([PHONE],6),3)
Here's one approach, assuming the field is a string:
Substring([FIELDNAME],3,3)
If you always want the 4-6th characters, you could use: Substring([Field1],3,3)
EDIT: @sjm beat me to the punch...
Two more options, just for kicks
If you always want to trim the exact same string from the left & right:
TrimRight(TrimLeft([Field1],”123”),”7890”)
If you always want to trim the same number of digits from the left & right:
RegEx_Replace([Field1],”\d{3}(\d{3})\d{4}”,”$1”)
NJ
TrimRight([your_field_here],'county')
I got it to work by using Replace instead of TrimRight
Replace([County], ' County', '')
It's not limited to only the right side of the field though.
I like it thank you.
By that logic, TrimRight([County ],' County') should work, but it trims all of the letters within the string from the right, not just the complete string. Moral: Verify.
I stumbled across this thread after typing in “trim functions in Alteryx” into my google search bot and wanted to take a quick moment to say 2 things here...
First, great question and great responses!
Second, though all the functions above are beautiful and creative and most important, they work! I would advise anyone with a similar question to first and foremost plop a select tool in front of your data and look at the data type. The trim function, for example does not react well to ‘numeric’ data types. With that said, before copying and pasting functions into your formula tool only to see ugly red error messages, check your data type because you may just need to convert a field or two and be on your way again.
Lucky for us, Alteryx makes data type conversions super easy with the select tool (it is literally a drop down and select menu) and then off you go back to your formula! Alteryx also has documentation to refer to so you don’t have to pain stake every data type nuance on your own. (Google search Alteryx functions documentation)
This is not a solution, just a friendly reminder for someone who might find it useful in their journey! 🙂