Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

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

Replace standalone characters from a string

lipster26
7 - Meteor

Hello,

 

I have some cells that contain "NA". I would like to replace the "NA" in all cells. But some cells have words like "Natural." How can i replace the "NA" in all cells without affecting the words like "Natural?"

 

Thanks.

4 REPLIES 4
ShankerV
17 - Castor

Hi @lipster26 

 

Please use the below formula.

 

If [column name] != "Natural" 

Then "NA"

Else [column name]

Endif

 

Many thanks

Shanker V

IraWatt
17 - Castor
17 - Castor

Hey @lipster26

You could use the Formula Tool and update the column with a formula like:

IF [Column Name] = "NA" THEN "" ELSE [column Name] ENDIF
RobertOdera
13 - Pulsar

Hi @lipster26 

 

Consider using:

1. TRIM(REGEX_Replace([Column],"NA",'')) where Column is where the values you want to replace are, '' means replace with blank, and TRIM removes any extra blanks/spaces

2. Use the Text Tool. First column = List of words that you need to replace. Second Column = blank values.  Then use the Find and Replace tool to replace those words with the blanks in the Second Column

 

Works better if you have a sample that we can help you workflow...cheers!

gaoa
11 - Bolide

Hi @lipster26 

 

If I understand your question correctly, please try using the formula below: 

 

if contains([Field1],"NA",0) then replace([Field1],"NA","") else [Field1] endif

 

Test:

gaoa_0-1679207910790.png

 

Let me know if it works as expected in your dataset. Thanks!


Labels