Alteryx Designer Desktop Discussions

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

Getword() and the Countword()

mxledesma
7 - Meteor

 I am doing the Try it exercise of the Formula Tool Can anyone explain to me why

 

Formula - GetWord([Address], CountWords([Address])-1) within the Formula tool.

I just dont understand why within Countwords the string has Address and a -1. Why -1. If i omit

the -1 it gives a parse error.

 

8 REPLIES 8
grazitti_sapna
17 - Castor

Hi @mxledesma , as the question says you need to fetch the address suffix therefore, countword(address -1) it reads from backward. If you will use countword(address -2) then it will fetch Jasmine counting second word from the back.

 
 
 
 
 
 
 

 



Thanks!

Sapna Gupta
mxledesma
7 - Meteor

Thanks

grazitti_sapna
17 - Castor

@mxledesma  You're welcome.

Sapna Gupta
Nazia
5 - Atom

@grazitti_sapna pls clarify if i need to use countword or getword to get suffix 

Example : If the address is 376 S JASMINE ST and I need the address suffix (which is the last word of the address then how do I go about?)

Is anyone else getting the error "The field "" is not contained in the record"?  I'm not sure how to interpret this even though I used the same formula as above.

Alteryx Formula - Getword.PNG

Skuhn
5 - Atom

Try removing the space before "countwords"

Ereon
7 - Meteor

You need to create a Column named Suffix.  Currently you do not have the formula tied to any column

 

Rlopez21
7 - Meteor

Example: [Address] - 376 S JASMINE ST

 

Getword() function counts starting at 0. So 0,1,2,3. 

Getword([Address], 0) = returns the very first word of the sentence =  "376"

 

Countword() counts starting at 1. So 1, 2, 3, 4. 

 

Solution

Getword([Address],CountWords([Address])-1)

You have to add -1 because CountWord will return a 4, but GetWord sees the very last word as word #3. 

 

Labels