Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Replacing text with other text

EricaDakin
5 - Atom

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?

4 REPLIES 4
CarlDi
Alteryx
Alteryx

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

afv2688
16 - Nebula
16 - Nebula

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

JohnJPS
15 - Aurora

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

EricaDakin
5 - Atom

That one works, thanks very much!

Labels