community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Replacing text with other text

I have a problem with replacing some text in my file. My data has a Religion field, where some values are duplicates but with different text. Specifically I have these three options:

Other

Other Religion or Belief

Any Other Religion or Belief

 

I want to replace the first two with the last, but because that value includes the first two, I cannot simply enter a Replace formula where I replace "Other" and "Other Religion or Belief" with "Any Other Religion or Belief", because I end up with a field that says Any Any Any Other Religion or Belief Religion or Belief".

 

Any ideas on how I fix this?

Alteryx
Alteryx

hey @EricaDakin - a lookup table utilizing the Find & Replace tool maybe the best option here.

Alteryx Partner
Alteryx Partner

Hello @EricaDakin ,

 

Another option would be to use the formula tool:

 

IF [Religion] = "Other" OR "Other Religion or Belief"

THEN "Any Other Religion or Belief"

ELSE [Religion]

ENDIF

 

Cheers

ACE Emeritus
ACE Emeritus

Hi @EricaDakin,

 

If the list of replacements is short, you can use a switch statement...

Switch([f1],[f1],
"Other","Any Other Religion Or Belief",
"Other Religion Or Belief","Any Other Religion Or Belief")

... otherwise a lookup table can work; just make sure, in this example, to match against the entire string; (see attachment).

 

Hope that helps!

John

That one works, thanks very much!

Labels