Alteryx Designer Desktop Discussions

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

Remove text from fields

tbradley
5 - Atom

Hello all,

 

Once a week I am given a set of data in excel which has 6 columns which should only include dollar amounts. However, sometimes the input data I receive includes text that a user puts in such as "FLAG", "N/A", "UNKNOWN", etc. I can not control what text is written in the cells, it is just given to me.

 

In any event, I just need to make anything that is text in the any of these fields "0". I don't really care what is written in the cell, I just need to change it to zero. The cell could really say whatever the user puts in, so there is an endless possibility of text or phrases that could end up in one of these cells.

 

My problem: I need to remove any text from the fields and make them "0", while still maintaining the dollar amounts that are already in each field (which also includes cents, so I need to keep the period that separates the dollars and cents in the formatting)

 

Example: I want to take excel data that has the text in red in the table below 

Column 1Column 2Column 3Column 4Column 5Column 6
3.005.005.00UNKNOWN6.0019.00
1.002.003.004.005.0015.00
3.00FLAG5.003.0016.0027.00
12.009.00N/A12.00FLAG33.00
3.005.005.001.006.0020.00

 

And replace with 0s as shown in this table.

Column 1Column 2Column 3Column 4Column 5Column 6
3.005.005.000.006.0019.00
1.002.003.004.005.0015.00
3.000.005.003.0016.0027.00
12.009.000.0012.000.0033.00
3.005.005.001.006.0020.00

 

Anyone have any suggestions?

3 REPLIES 3
Emil_Kos
17 - Castor
17 - Castor

Hi @tbradley,

 

Just change the data type to double and you will remove everything except numbers:

 

Emil_Kos_0-1611260727523.png

If you have more fields you can select them all at once and change all data types using this tip:

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/change-all-fields-from-vstring-to-nume...

vizAlter
12 - Quasar

Hi @tbradley — Welcome to the Alteryx Discussions!

 

Try this solution:

1st use a "Select" tool to change the data type to double, then use a tool "Imputation" to fill the "Null" value to "0"

 

vizAlter_0-1611262874393.png

 

Emil_Kos
17 - Castor
17 - Castor

Hi @tbradley,

 

If zeros are the requirement you can also use the data cleansing tool with this configuration:

 

Emil_Kos_0-1611263248257.png

 

Labels