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

Stacking Functions

MattR79
8 - Asteroid

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 REPLIES 3
atcodedog05
22 - Nova
22 - Nova

Hi @MattR79 

 

Is this what you are looking for

 

atcodedog05_0-1644605741216.png

 

Hope this helps : )

 

MattR79
8 - Asteroid

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!

Labels
Top Solution Authors