Convert number with brackets to negative numbers including the decimal places
- 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
Hi All,
I am trying to convert this (475,971.29) string by replacing the '(' ')' and making it as a positive number using the formula component, but not getting proper output with correct decimal places.
IF
StartsWith([Outstanding], '(') AND EndsWith([Outstanding], ')')
THEN
ToNumber('-'+REGEX_REPLACE([Outstanding],'[[:punct:]]|[\$\+<=>\^`\|~]',''), '0')
ELSE
ToNumber([Outstanding],'0')
ENDIF
Input: (475,971.29)
Expected output: -475971.29
Solved! Go to Solution.
- Labels:
- Designer Cloud
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I think your RegEx is replacing the decimal point? You don't need RegEx for this anyway, a simple formula will do it.
ToNumber(Replace(Replace([Outstanding], '(','-'), ')',''))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Don't need to use regex.
With basics formula functions, you can easily do that. Find the solution attached.
Let me know if it works as you want and do not hesitate to mark this answer as solution if it helped.
