mkumars
mkumars

Reputation: 533

Using a condition in Alteryx but doing nothing if none of the conditions match then do nothing

I have a survey that as fields like

"4 - agree" "3 - neutral" "2 - disagree" "1 - completely disagree" and random comments which consists of open-ended feedback.

I want to replace the first 4 with 4, 3, 2, 1 respectively - but if it not any of those then I just want to keep it as it is.

For example, if it just says "The session was good" I'd just like to leave it like that.

I have tried switch, and tried to use two "replace()" and IF statement, but it does not seem to work.

Upvotes: 0

Views: 28

Answers (1)

johnjps111
johnjps111

Reputation: 1170

Does something like this work, in a Formula tool:

IF left(trim([field]),1) in ('1','2','3','4') THEN
    left(trim([field]),1)
ELSE
    [field]
ENDIF

Upvotes: 0

Related Questions