Alteryx Designer Desktop Discussions

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

formula for specific doc #'s

ttiverson98
5 - Atom

I am trying to create a formula that will return doc #'s starting with a specific number combination then assign them to a Category

 

If Doc # starts with 19 (and contains only 7 characters), then apply "A" to Category

If Doc # starts with 40 (and contains 10 characters), then apply "B" to Category

 

Thanks,

Todd

 

Desired output

 

Doc#                Category

1912345                A

1912999                A

1999999999          other

4000000001          B

4000009999          B

409999                  other

1 REPLY 1
atcodedog05
22 - Nova
22 - Nova

Hi @ttiverson98 

 

Formula like below should work

 

 

IF StartsWith(ToString([Doc# ]), "19") 
and Length(ToString([Doc# ]))=7
THEN "A" 
ELSEIF StartsWith(ToString([Doc# ]), "40") 
and Length(ToString([Doc# ]))=10
THEN "B" 
ELSE "others" ENDIF

 

 

Workflow:

atcodedog05_0-1625759369142.png

 

Hope this helps 🙂

Labels