This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
on 08-15-2016 03:23 PM - edited on 07-27-2021 11:37 PM by APIUserOpsDM
How do you convert a string with a $ sign into a number?
1. First remove the dollar sign and commas out of the string
2. Convert () to a negative sign "-"
3.ToNumber() function
Input:
Output:
There are many ways to do this in Alteryx, here are a few:
Example 1
Formula Tool - ToNumber(Replace(Replace(Replace(Replace([Data], '$', ''), ',' , ''), ')' , ''), '(' , '-'))
Example 2
Formula Tool -ToNumber(REGEX_Replace(REGEX_Replace([Data], "\$|,|\)", ""), "\(", "-"))
Example 3
RegEx Tool #1 - Replace\$|,|\) with Replacement Text "blank", then
RegEx Tool #2 - Replace \(with Replacement Text "-"
Select Tool - Change Type to Fixed Decimal
See attached workflow.
Example #2 is the easiest!