In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

If a cell contains Text

DodgerFH
7 - Meteor

I am trying to clean some data before importing it into a file.  I CANNOT change the original source.   

 

Working on a Zip Code field,  but sometimes it contains letters for other countries.   Is there a way to highlight cells that contain text?  I am wanting to replace any cell that contains text with a zero.  Not sure how to specify in a formula that it is text.   

 

Any help appreciated

4 REPLIES 4
alexnajm
18 - Pollux
18 - Pollux

IIF(Regex_Match([Field],".*[[:alpha:]]+.*"),"0", [Field])

Carolyn
12 - Quasar
12 - Quasar

RegEx! 

 

You can use RegExMatch to flag when text is present and then filtered for when a non-number is found (I used \D = not a number - it'll catch spaces and special characters too)

 

     REGEX_Match([Zip], ".*\D.*")

 

You can use RegExReplace to replace a non-number with a 0

 

     REGEX_Replace([Zip], "\D", "0")

 

See attached workflow example

DodgerFH
7 - Meteor

Thanks! This worked perfectly.   Really appreciate the quick response.  Have a great day! 

Carolyn
12 - Quasar
12 - Quasar

@DodgerFH - Yay, glad it worked for you! Please mark your question as solved. You should be able to "accept as solution" for the reply/replies that solved it. It makes it easier for others to go right to the solution if they have the same question :) 

Labels
Top Solution Authors