Alteryx Designer Desktop Discussions

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

How to replace a word or characters with another word in a column?

maddoxs
7 - Meteor

I tried using a filter for this to replace all rows that have 3001 to be changed to 1380. Is there a different way to get this to work? Thank you all

maddoxs_0-1659623214864.png

maddoxs_1-1659623258396.png

 

 

6 REPLIES 6
IraWatt
17 - Castor
17 - Castor

Hey @maddoxs,

You have one to many brackets at the end the formula should be:

IraWatt_0-1659623596702.png

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

Watermark
12 - Quasar
12 - Quasar

Try placing a "tostring" in front :    Replace(tostring([number]),'3001', '1380')

maddoxs
7 - Meteor

Once I close the bracket at the end it stops showing colors. 

maddoxs_0-1659625435979.png

maddoxs_1-1659625447204.png

 

 

IraWatt
17 - Castor
17 - Castor

The issue is that replace function only works on text data not numeric. Your data most likely comes in as a integer (number data type):

IraWatt_0-1659625588180.png

You can convert it to a string/text data type with a select tool:

IraWatt_1-1659625657282.png

Or you can use the two string method as @Watermark suggested.

 

The community has some quick and easy videos on formulas and the Formula Tool here Writing Expressions 

 

 

Watermark
12 - Quasar
12 - Quasar

If you want to leave it as a number, you could also go with an  "If Then" statement 

 

if [number]=3001
then 1380
else [number]
Endif

 

 

However this will only change that 1 number, so if it's just a replace that 1 then cool, otherwise you'll have to expand to take other options into account.

IraWatt
17 - Castor
17 - Castor

Great point @Watermark 😅 !

Labels