SOLVED
even or odd
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
timothysmith_NYFRB
7 - Meteor
‎12-21-2021
12:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How do I make a formula that tells me if a number is even or odd
Solved! Go to Solution.
Labels:
- Labels:
- Best Practices
4 REPLIES 4
CarliE
Alteryx Alumni (Retired)
‎12-21-2021
12:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
‎12-21-2021
12:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can use the mod() function to check.
iif( mod([field_w_number], 2) = 0, 'even', 'odd' )
Bob
‎12-21-2021
12:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
thank you that worked perfectly
20 - Arcturus
‎12-21-2021
02:46 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
