community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Using Excel Text() Formula

Meteoroid

How do I write a formula to convert a number to a text field with 4 characters? In Excel, I use a simple Text() formula: =text(A1,"0000") where A1 equals 123 and the output adds a leading '0' to '0123'. 

Highlighted
Alteryx Certified Partner

Hi @tarichar 

 

Something like this should work:

 

PadLeft(ToString([FieldName]),4,"0")

 

Meteoroid

Thanks for the feedback; however, I also have values in my data sample that already have leading 0's that need to be removed as well: i.e. 001234 needs to convert to 1234. Would I need to write a separate PadRight formula or is there a different formula that would address both conditions? Thanks again, and apologies for not listing this scenario in my original inquiry. 

Labels