Alteryx Designer Desktop Discussions

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

Get rid of unwanted words

garretwalters12
8 - Asteroid
I have cells that contain the words "city of ...." and county of....." (dots theres instead of actual city and county names). What formula can I use to just have the city name and not "city of" or "county of" in front?
3 REPLIES 3
TravisR
Alteryx Alumni (Retired)

 

IF Contains([your_field], "city of") THEN TrimLeft([your_field], "city of")
ELSEIF Contains([your_field], "county of") THEN TrimLeft([your_field], "county of")
ELSE [your_field]
ENDIF

That should do it. 

Lund
6 - Meteoroid

 

1) "Text to columns" and use space as delimiter.

 

2) Or use Regex: 

(\<\w+\>$)

This one will always grab the last word in your sentences so if you have sentences like "County of greater London" and "County of London" it will work either way.

 

Find both solutions in the attached workflow

 

 

brindhan
9 - Comet

You could also use the regex tool, with output method 'replace' and expression  [(city of)(country of)] 

This gives you an option of just including any more words you want to exclude by just adding toin this expression.

 

Cheers,

Brindha

Labels