Alteryx Designer Discussions

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

even or odd

timothysmith_NYFRB
6 - Meteoroid

How do I make a formula that tells me if a number is even or odd

4 REPLIES 4
CarliE
Alteryx
Alteryx

Hi @timothysmith_NYFRB 

 

 

You can use a formula tool to create a new field with the following expression:

 

iif(Mod([Numbers], 2)=0, "Even", "Odd")

 

This statement says if the remainder of the value in the number field divided by 2 is zero, then the number is even. Otherwise it is odd. 

 

Please mark as a solution if this helped solve your problem!

 

Thanks,

Carli
BobR
7 - Meteor

You can use the mod() function to check.

iif( mod([field_w_number], 2) = 0, 'even',  'odd' )

Bob

timothysmith_NYFRB
6 - Meteoroid

thank you that worked perfectly

MarqueeCrew
19 - Altair
19 - Altair

Btw 

 

iif(mod([number]),"odd","even") should work too.  

it requires less effort in cpu. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Please Subscribe to my youTube channel.
Labels