Alteryx Designer Desktop Discussions

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

Stacking Functions

MattR79
Asteroide

I am trying to trim some data that is all in the same column, however not all data elements are going to be the same length, for instance, if a cell contains NUSGCS I want to trim it to 12 characters, however if it contains CTCS it would be 11, or contains P- it would be 6 and other variations on this theme.  Is there anyway to do this in a formula?  I have tried using an "if Contains" stacked with a "Trim Left" function but I keep getting a malformed statement error.  Attached is some sample data containing what I am working with.

 

if Contains([SECONDARY REFERENCE NUMBER], 'NUSCGS') then TrimLeft([SECONDARY REFERENCE NUMBER], '12') else
if Contains([SECONDARY REFERENCE NUMBER], 'CTCS') then TrimLeft([SECONDARY REFERENCE NUMBER], '11') else 'Blank' endif

3 RESPUESTAS 3
atcodedog05
22 - Nova
22 - Nova

Hi @MattR79 

 

Is this what you are looking for

 

atcodedog05_0-1644605741216.png

 

Hope this helps : )

 

MattR79
Asteroide

It sure is, I was using the wrong trim function and had a space in my elseif.  Thank you very much.

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @MattR79 

Cheers and have a nice day!

Encuestas
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Etiquetas