Start Free Trial

Alteryx Designer Desktop Discussions

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

Removing everything but the digits and hyphen

LexiC
6 - Meteoroid

How do I get rid of all the data after a digit?

 

Ex. I am annotating data from a pdf and it's pulling in "-125. |" 

 

I want to remove everything after the period so it's just "-125" I still need the '-' so the number stays negative 

6 REPLIES 6
rzdodson
12 - Quasar

@LexiC assuming it is coming in as a string field, you can use this in a subsequent formula tool to keep the -`15 you are needing.

 

ToNumber(Replace([Value], ".|", ""))

 

 

LexiC
6 - Meteoroid

I don't think that works because I don't think Alteryx see's the numbers a value. I have to convert it to a number when I export to excel. 

rzdodson
12 - Quasar

You can place a Select tool immediately following the Formula tool to convert it to a numeric field (Double, etc.). Once exported in to Excel, it will read it as a number while maintaining the negative sign.

ryanjones08
5 - Atom

You could use regex \..*$ to remove everything after the "." 

binu_acs
21 - Polaris

@LexiC one option with regex

image.png

LexiC
6 - Meteoroid

thanks very much - it worked perfectly!

Labels
Top Solution Authors