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

how to trim left of a specific word

barb_mooney
5 - Atom

I have a column of data that looks like this

DIESEL TRUCKDISTRICT 1

TRAILERDISTRICT 10

TRIPAC BATTERYDISTRICT 11

TRIPAC DIESELDISTRICT 2

VP TRUCKDISTRICT 4

I want to remove everything to the left of the word "District"

 

for the life of me I cant figure out how to do this

 

Help please!

 

4 REPLIES 4
ChrisTX
16 - Nebula
16 - Nebula

Try the RegEx tool.

 

Regular Expression:

(.*)(DISTRICT)(.*)

 

Output Method: Parse

ChrisTX
16 - Nebula
16 - Nebula

Or Regular Expression

(.*)(DISTRICT.*)

which gives this output:

 

Capture.PNG

jsi
5 - Atom

My Excel brain told me to use the formula tool and below formula into a new field:

 

Right([Field1], Length([Field1])-(FindString([Field1], "DISTRICT")))

 

where field 1 contains your data

 

For RegEx mentioned by @ChrisTX it also worked using this : (.*)(DISTRICT.*) but I am still a bit unfamiliar with RegEx myself.

barb_mooney
5 - Atom

this worked perfectly

 

thank you!

Labels
Top Solution Authors