We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Fix numbers with trailing minus signs

Clairc
6 - Meteoroid

Hi,

 

Does any one know how to fix numbers with trailing minus signs?

For example:

from 1234- to -1,234

 

thanks

Clair

10 REPLIES 10
apathetichell
20 - Arcturus

do you want them as numbers or strings?

 

tonumber(regex_replace([myfield],"(.*)(-)","$2,$1")) in a new integer field.

Clairc
6 - Meteoroid

Hi there,

 

thanks for your quick respond but the data preview shows "-," in front of the number, can you please advise how to fix it?

Clairc_0-1634857544276.png

 

thanks,

Clair

apathetichell
20 - Arcturus

my bad - second part should say "$2$1"

 

apparently my error doesn't matter when wrapping everything in a tonumber() btw.

Clairc
6 - Meteoroid

Awesome! thanks so much for your help!

apathetichell
20 - Arcturus

Glad to hear it worked! Play around with regex - it's very good for these kinds of problems. Also - if this helped can you mark the regex post as a solution? thanks!

Clairc
6 - Meteoroid

Sure, i will play around with regex. One question, how to mark the regex as a solution? Today is my first time play around this new tool.

Clairc
6 - Meteoroid

Hi there,

 

How come it still shows text format in the Excel output data? Anything wrong in my formula below?

Clairc_0-1634863492647.png

Clairc_1-1634863523297.png

 

apathetichell
20 - Arcturus

? if you output data to excel it's always text. if you want numbers you have output to a formatted range or use a table tool and then render. note - render will re-write any data in your .xlsx file.

Clairc
6 - Meteoroid

Sorry, i'm new to this tool, do you mind to provide more instructions/screenshot on how to use table tool/render.note to covert text to number in the output excel file? thanks.

Labels
Top Solution Authors