Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Error: Negative Numbers - Text to Number Creating Nulls or Zeros

Jpschnee
6 - Meteoroid

Hey All,

 

I am working with a large set of data, and the file we received is a csv so all data formats are default as v_wstring. This is creating negative umbers to be shown as (100) instead of -100. Since doubles do not accept () they are being forced as nulls or errors. Does anyone have a quick formula for converting this entire column to a number format while keeping the negative values? 

 

I have seen forums where people want the opposite of this but any insight would be helpful.

 

Thank you,

Jordan

3 REPLIES 3

Hi @Jpschnee 

 

Hope the below helps. the "Select" at the end is to change the type to Double. Cheers

 

christine_assaad_0-1610655660181.png

 

Jpschnee
6 - Meteoroid

thank you!!!

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Jpschnee,

 

I'd use a multi-field formula so you can change the TYPE as part of the configuration to a DOUBLE.

 

ToNumber(IIF(left([_CurrentField_],1)="(","-"+replacechar([_CurrentField_],"()",''),[_CurrentField_]))

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels
Top Solution Authors