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
binuacs
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
17 - Castor
17 - Castor

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

 

Edit: just beat me @binuacs, 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