Tool Mastery

Explore a diverse compilation of articles that take an in-depth look at Designer tools.
Become a Tool Master

Learn how you can share your expertise with the Community


Tool Mastery | Formula

Alteryx Alumni (Retired)

This article is part of the Tool Mastery Series, a compilation of Knowledge Base contributions to introduce diverse working examples for Designer Tools. Here we’ll delve into uses of the FormulaTool on our way to mastering the Alteryx Designer:


Data blending, transformation, and cleansing..oh my! Whether you're looking to apply a mathematical formula to your numeric data, perform string operations on your textfields (like removing unwanted characters), or aggregate your spatial data (among many other things!), the Formula Tool is the place to start. With the examples provided below, you should be on your way to harnessing the many functions of the Formula Tool:



It doesn't stop there, either. The Formula Tool and it's Multi-Row or Multi-Field counterparts are a one-stop-shop for manipulating your data sets - and there are plenty more functions to choose from. If you're working with strings specifically, our Live Training Working with Strings in Alteryx might help. If you're cleaning your data set, be sure to also check out the Data Cleansing Tool (in action here) first to more easily replace nulls in your data, modify case, remove unwanted characters across any fields you select, or trim whitespace.


To help you get started, here is a quick tour of the Formula tool's interface.


Output Column


The output column is specified in the top-left corner of an expression. You can modify an existing field by selecting an existing field name from the drop-down menu, or create a new field by typing in a new field name.




Data Type


The default data type for a new field is V_WString with max length. You can change the data type of a new field in the drop-down menu under the expression editor.





Variables, Functions and Saved Expression Menus


You can find the variables, functions, and saved expression menus under the buttons on the left-side of the expression window.






Expression Order


Expressions in a Formula tool are executed sequentially in order. To change the order of an expression (when minimized, or expanded), move the mouse over the handle:










Click and drag the expression to the new location (the blue line indicates the new position):




The expressions are now reordered. Note that expressions are executed sequentially in the formula tool. Also, only one expression can be moved at a time.




Removing an Expression


To remove an expression, expand the expression by clicking on the caret next to the expression:




Then click on the trash can to remove the expression:




Adding Expressions to the Formula tool


Click on the expression window, and press ctrl+space to see a full list of all the functions, constants, and incoming fields:




The Formula Tool will display a list of the functions, columns, and constants that are available:




Typing will automatically filter the results. NOTE: typing ‘dat’ returns functions that start with ‘dat’ as well as functions that contain ‘dat':





The new autocomplete functionality finds functions related to what has been typed. For example, if a user wanted to use a function to calculate the average, and started typing ‘av…’, the autocomplete function shows matching functions:



Press enter to complete the formula:




There are three ways to add columns to your expression:


1. Type the column names

2. Use the Columns or Constants buttons:

  • To add columns, click on the Columns or Constants buttons (1), and
  • Search for columns by typing the column name in the search window (2) and then double-clicking on the column to insert it into the formula (3)
  • Double-clicking on the column or constant name to insert it into the formula (3)



3. Inserting a left bracket ([) in the formula will display a list of columns and constants that may be inserted into the formula:




The completed formula:




Data Preview:

The Data Preview window will be empty until the workflow is run once (data preview will be available if the workflow has been run for one tool upstream previously):



After running the workflow:




Subsequent formulas will preview the data without running the workflow:




If the formula contains an error, the Data Preview will show the error:




Formula display size:


Pressing CTRL + increases the size of the formula:




Pressing CTRL - decreases the size of the formula:



By now, you should have expert-level proficiency with the Formula Tool! If you can think of a use case we left out, feel free to use the comments section below! Consider yourself a Tool Master already? Let us know at if you’d like your creative tool uses to be featured in the Tool Mastery Series.


Stay tuned with our latest posts every Tool Tuesday by following Alteryx on Twitter! If you want to master all the Designer tools, consider subscribing for email notifications.

Additional Information

Click on the corresponding language link below to access this article in another language -

8 - Asteroid

Is there a way to put some comments inside the expression box? I have formula tools with multiple expressions, and putting a little explanation next to each one would help me keep track of what each one is supposed to do.

Alteryx Alumni (Retired)

@MichalK yes!

/*Comment*/: Block Comment: Allows you to add comments to an expression editor (within the expression line) without interfering with the expression.

//Comment: Single Line Comment: Allows you to add comments to an expression editor without interfering with the expression.

5 - Atom

In one of the formula tool, I can see [user.fieldname]. please help me to understand this

7 - Meteor

good and succinct post!

7 - Meteor

This is an awesome post! How do you recommend extracting the file path using the formula tool? 

8 - Asteroid

Hi guys, 


Does anyone knows how to insert a number in the left for a string value, I have several string dates with this format 20072020, some dates are like this 1072020, so when I use DateTime it does not recognize the customized format. I need to add a zero at the left in this cases so the DateTime tool can change the string value to date.


Thanks in advance

Alteryx Alumni (Retired)

@adrilarotta I believe you're looking for padLeft...

PadLeft([Field1], 8, '0')
7 - Meteor


6 - Meteoroid

I am gradually learning this. 

6 - Meteoroid

HELLLLLPPP Please. i don't want to loose my concentration. i am struggling to concatenate text strings from different columns into one column using the formula tools. please i have tried to add up the two words but i am not satisfy with my work. 

Alteryx Alumni (Retired)

@MikaelO  The plus symbol, otherwise known as the addition operator '+', is also used for string concatenation.

Example: [ColumnName]+[ColumnName]


You can also concatenate literal strings as well.

Example: "Hi "+[ColumnName]


The spaces around the plus symbol don't impact the results, nor does using single- or double-paired quotes around a literal string. 

7 - Meteor

The formula tool is very helpful.. just have exercise to get a clear understanding on all the capabilities

6 - Meteoroid

For the Try It section for this module, can someone explain what is happening with the solution:


What does the - symbol do?