Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Remove some Zeros but Not All

mmh2023
6 - Meteoroid

Hi! 

I am trying to figure out a formula to remove the last three zeros in a string but still keeping one of the zeros so that it is a 4 digit number. 

 

For example: in the RegExOut1 column first line I would like for that to output to the account column as 1130 instead of 1130000

maddiehamn_0-1681937734872.png

Thank you! 

4 REPLIES 4
BS_THE_ANALYST
14 - Magnetar

@mmh2023 
REGEX_REPLACE([RegExOut1], "(.*)000$","$1")

 

 

binuacs
20 - Arcturus

@mmh2023 What is the data type of your Account field? is it double?

BS_THE_ANALYST
14 - Magnetar

perhaps LEFT([RegExOut1],4) is also achieving what you want? If you only want the first 4 digits @mmh2023 

 

binuacs
20 - Arcturus

@mmh2023 Another option with the string functions

binuacs_0-1681938579211.png

ReverseString(Substring(ReverseString(toString([ RegExOut1])),2,Length(toString([ RegExOut1]))))
Labels