In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Formula Tool

Elena_B1
7 - Meteor

Hello, Kindly help to correct the formula. IF Contains[ACCOUNT], [0-9] THEN "" ELSE [ACCOUNT] ENDIF

 

To check if a field named [ACCOUNT] that is a string contains any digits and return an empty string if it does, and the original field otherwise.

 

Thank you.

3 REPLIES 3
binu_acs
21 - Polaris

@Elena_B1 One way of doing this with the Regex_CountMatch function

IIF(REGEX_CountMatches([Account], '\d') > 0, '', [account])

binuacs_0-1682373308943.png

 

alexnajm
19 - Altair
19 - Altair

IF Regex_Match([ACCOUNT],".*\d.*")=-1 THEN "" ELSE [ACCOUNT] ENDIF

 

Edit: just beat me @binu_acs, great solution too!

SPetrie
13 - Pulsar

The contains formula needs parentheses to be in proper syntax.

IF Contains([ACCOUNT], [0-9]) THEN "" ELSE [ACCOUNT] ENDIF

The problem you will still run into is that it will be looking for a column named [0-9] and expecting a string there, so it wont really do what you want it to do.

You may have better results using a regex match formula

 

if REGEX_Match([Account],".*[0-9].*") then "" else [Account] endif

 

 

SPetrie_2-1682373600827.png

 

 

 

Labels
Top Solution Authors