Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Filtering out incorrect user input Zip Codes

CNichols84
7 - Meteor

I have a feeling this is very simple, but as someone who is new to Alteryx I am struggling to find a solution:

 

I have a Field, "Zip Code", which is full of freeform user input data, which means that anything and everything could be input - all I am trying to do is use a formula to say 'If [ZipCode] is 5 numbers then [ZipCode] OR if [ZipCode] is in this format with all numbers XXXXX-XXXX" then [ZipCode]" 

 

 

Can someone help me please?

 

Thanks!

3 REPLIES 3
ShankerV
17 - Castor

Hi @CNichols84 

 

One way of doing this.

 

ShankerV_0-1683734723747.png

IF REGEX_Match([Zip code], "\d{5}")
THEN [Zip code]
ELSEIF REGEX_Match([Zip code], "\d{5}\-\d{4}")
THEN [Zip code]
ELSE null()
ENDIF

 

ShankerV_0-1683734763434.png

 

Many thanks

Shanker V

ShankerV
17 - Castor

Hi @CNichols84 

 

If I understand the question the other way to filter.

 

ShankerV_0-1683734979025.png

REGEX_Match([Zip code], "\d{5}") OR
REGEX_Match([Zip code], "\d{5}\-\d{4}")

 

ShankerV_1-1683734996953.png

 

 

Many thanks

Shanker V

CNichols84
7 - Meteor

Thank you very much, it worked perfectly!! You understood exactly what I was going for :)

Labels
Top Solution Authors