Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Removing Text from Dataset

kamos
5 - Atom

I have a huge quantity of location ID codes that I am trying to turn into a usable format. My fields are consistently formatted as either:

 

ST-HI

ST-CA

ST-CO

ST-MD

ST-WY

 

OR

 

CO-AURORA

MO-STL

IL-CHICAGO

OH-DAYTON

 

I need to extract ONLY the state abbreviation. I think the best solution is to remove the "ST-" from the beginning of any relevant row. Then, remove everything after the "-" for all fields formatted as "STATE ABBREVIATION-CITY".

 

What is the best way to remove the "ST-" and also the "-CITY"? I am newer to Alteryx, but the tools I am trying give me poor results or affect things that I do not want them to affect.

 

I appreciate the help!

-K

 

 

3 REPLIES 3
acastelazo
8 - Asteroid

You can do this with a formula as long as the standalone states always begin with "ST" like this:

 

Capture.JPG

PhilipMannering
16 - Nebula
16 - Nebula

There are lots of way you could do it.

 

One way,

 

Regex out state - Capture.PNG

kamos
5 - Atom

Thank you PhilipMannering and acastelazo!!

 

I really appreciate the help!! 

Labels
Top Solution Authors