In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Add characters to field values if missing

ZoeM
8 - Asteroid

hi!

I have a field that I would like to add characters to at the beginning if they are missing. Please see simple example below, the two missing entries should also have "SI-" added to the beginning. 

I would like to complete this using a Formula Tool.

 

Any help rendered truly appreciated. 

 

StateID
MISI-1234
FL5678
CASI-2345
NMSI-7890
OK8520
TXSI-7412
MOSI-6542
ILSI-6548
WISI-9510
5 REPLIES 5
DataNath
17 - Castor
17 - Castor

Hey @ZoeM, here's how I'd go about this, leveraging the StartsWith() function:

 

DataNath_0-1664375645302.png

 

The exclamation mark is uses as NOT and so in this expression we're essentially saying: if the ID doesn't begin with SI then add 'SI-' to the ID number. The else tells Alteryx to leave the ID as is if it doesn't satisfy the if condition i.e. does begin with SI.

MilindG
12 - Quasar

MilindG_0-1664375678187.png

See if this fixes your problem.

binu_acs
21 - Polaris

@ZoeM One way of doing this

binuacs_0-1664375863552.png

 

Emmanuel_G
13 - Pulsar

@ZoeM 

 

Find in attachement one way of doing that

 

Emmanuel_G_0-1664376015241.png

 

ZoeM
8 - Asteroid

While all solutions provided the same answer, I had to choose one :)

Labels
Top Solution Authors