Alteryx Designer Desktop Discussions

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

Formula and Multiple 'IF' arguments

jolenecox
5 - Atom

I receive an error message "Contains requires 2 or 3 arguments" for the below formula:

 

IF CONTAINS([CREDIT_RATING],"T1","t1","V8","in","ST","f1","t5","Y","NR","t4","fa","M9","I1","CC","B9","V9","LS","I0","NN","F","l1","L0","G0","A0","4F","L3") && ([CARD_STATUS] = 'Active') THEN "Check"
ELSE "OK"
ENDIF

 

Does anyone know how to resolve this? I believe the issue is that I am asking to check multiple arguments (as this works when I only check one argument i,e "T1". Is there a formula for multiple arguments?

4 REPLIES 4
OllieClarke
15 - Aurora
15 - Aurora

Hi @jolenecox unfortunately the CONTAINS() function can only look for 1 argument, so you'll have to rewrite the formula like this:

IF (
CONTAINS([CREDIT_RATING],"T1") 
OR CONTAINS([CREDIT_RATING],"t1") 
OR CONTAINS([CREDIT_RATING],"V8") 
OR CONTAINS([CREDIT_RATING],"in") 
OR CONTAINS([CREDIT_RATING],"ST") 
OR CONTAINS([CREDIT_RATING],"f1") 
OR CONTAINS([CREDIT_RATING],"t5") 
OR CONTAINS([CREDIT_RATING],"Y") 
OR CONTAINS([CREDIT_RATING],"NR") 
OR CONTAINS([CREDIT_RATING],"t4") 
OR CONTAINS([CREDIT_RATING],"fa") 
OR CONTAINS([CREDIT_RATING],"M9") 
OR CONTAINS([CREDIT_RATING],"I1") 
OR CONTAINS([CREDIT_RATING],"CC") 
OR CONTAINS([CREDIT_RATING],"B9") 
OR CONTAINS([CREDIT_RATING],"V9") 
OR CONTAINS([CREDIT_RATING],"LS") 
OR CONTAINS([CREDIT_RATING],"I0") 
OR CONTAINS([CREDIT_RATING],"NN") 
OR CONTAINS([CREDIT_RATING],"F") 
OR CONTAINS([CREDIT_RATING],"l1") 
OR CONTAINS([CREDIT_RATING],"L0") 
OR CONTAINS([CREDIT_RATING],"G0") 
OR CONTAINS([CREDIT_RATING],"A0") 
OR CONTAINS([CREDIT_RATING],"4F") 
OR CONTAINS([CREDIT_RATING],"L3")
) 
AND ([CARD_STATUS] = 'Active') 
THEN "Check"
ELSE "OK"
ENDIF

 I'm assuming that the commas in your contains were working as an OR rather than an AND.

 

Hope that helps,

 

Ollie

jolenecox
5 - Atom

Great, works perfectly. Thanks Ollie!

messi007
15 - Aurora
15 - Aurora

@jolenecox,

 

You can do that with find and replace as well:

 

messi007_0-1612954836134.png

Attached the workflow,

 

Regards

jolenecox
5 - Atom

Thanks @messi007 - as you can tell I'm just warming up with Alteryx!

Labels