Alteryx Designer Desktop Discussions

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

Have text file where minus sign is at end of string instead of beginning

sgrabish1
8 - Asteroid

I have a text file that has negative numbers where the minus sign is at the end of the string instead of the beginning.

 

I tried used multi-field formula to identify the instances where this has occurred.  I need my final output to be numeric where the minus sign is moved to the beginning and can be converted into a numeric value with its respective negative value.

 

Any help here greatly appreciated!

 

Thanks,

 

Stan

1 REPLY 1
jamielaird
14 - Magnetar

Hi @sgrabish1 


Something like this will do the trick. Use a multi-field formula. You can simplify the formula significantly if you tidy up all the whitespace first.

 

Screenshot 2019-05-14 at 19.53.44.png

ToNumber(IF Right(Trim([Field1]),1) = '-' 
THEN ToNumber(Left(Trim([Field1]),Length(Trim([Field1]))-1))*-1
ELSE Trim(Field1)
ENDIF)
Labels