ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Fix numbers with trailing minus signs

Clairc
Meteoroid

Hi,

 

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

For example:

from 1234- to -1,234

 

thanks

Clair

10 ANTWORTEN 10
apathetichell
Arcturus

do you want them as numbers or strings?

 

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

Clairc
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
Arcturus

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

 

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

Clairc
Meteoroid

Awesome! thanks so much for your help!

apathetichell
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
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
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
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
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.

Beschriftungen
Top-Lösungs-Autoren