The formula tool in Alteryx is very useful when trying to update any column, it does this by using one or several expressions in order to perform various calculations & operations.
A specific example of this can be seen by using the 'countword()' & 'getword()' functions in order create a new column that only contains the address suffix in my dataset.
![](https://www.thedataschool.co.uk/content/images/2022/08/image-281.png)
What we want to achieve with these functions is to create a new column that only contains ' ST', 'WAY', 'CIR' etc. This can be done in separate steps in the configuration pane or in one big step, I will show you how to do both:
1) Separately
Firstly, you would need to add a new column with the data type double and name it whatever you would like, in this case 'Suffix' and we would want to count how many words are in the address column for each row. For example, from the screenshot above '376 S JASMINE ST' would return 4 as there are 4 words in the address. the '-1' part of the expression is added because for the 'getwords()' the index starts with 0, whereas for 'countword()' starts with 1 & would allow for the next part to calculated.
![](https://www.thedataschool.co.uk/content/images/2022/08/image-287.png)
The second step is to create another column and we would call this one 'name' as it is returning the address suffix that we require from each row. From the screenshot below, it looks in the address column and takes the nth(from the suffix) word from each row, considering the index begins at 0 for '376 S JASMINE ST' it would read 'ST' and put that in the new column for that row.
![](https://www.thedataschool.co.uk/content/images/2022/08/image-295.png)
2) As a single function
Although you can do these steps separately and it makes the understanding much more coherent, it can all be done in big step as seen below, however there is not much difference in the writing of the operations.
![](https://www.thedataschool.co.uk/content/images/2022/08/image-298.png)