Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Generate Description Based on First Three Digits of Another Cell

Pburmester
5 - Atom

Hello everyone,

 

I am having some difficulty with a very simple formula. I want to generate a description in Column B based on the first three digits of the number in Column A. In Excel, it would be similar to an IF statement that contains the LEFT statement:

 

=If(left(CELL,3)="420","Description1",IF(left(CELL,3)="496","Description2",IF(left(CELL,3)="492","Description3")))

 

I've tried a Find and Replace and a Formula but have not been able to figure out a solution to this very simple task.

 

First three digits:

420 = Description1

496 = Description2

492 = Description3

 

 

Current Data Input:

NumberDescription
42042

 

42061 
49643 
49647 
49243

 

49261

 

 

 

Desired Output:

 

NumberDescription
42042

Description1

42061Description1
49643Description2
49647Description2
49243

Description3

49261

Description3

 

Any help would be much appreciated!

3 REPLIES 3
TylerNa
10 - Fireball

It sounds like you're on the right track @Pburmester. The attached workflow will give you one way to get at this. I just created a left formula and then a if then statement.

darryl5280
10 - Fireball

I would use the Switch Operator as I think it's more elegant.

 

/* 420 = Description1
496 = Description2
492 = Description3
*/
Switch(Left(ToString([Number]),3),"Unknown",
"420","Description1",
"496","Description2",
"492","Description3")

 

Switch Example.png

 

Pburmester
5 - Atom

Ah I knew it was an easy solution. Thank you for the help!

Labels