Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

even or odd

timothysmith_NYFRB
7 - Meteor

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

4 REPLIES 4
CarliE
Alteryx Alumni (Retired)

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
8 - Asteroid

You can use the mod() function to check.

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

Bob

timothysmith_NYFRB
7 - Meteor

thank you that worked perfectly

MarqueeCrew
20 - Arcturus
20 - Arcturus

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 restart. Order shall return.
Please Subscribe to my youTube channel.
Labels