Start Free Trial

Alteryx Designer Desktop Discussions

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

IF statement for non whole numbers

richleeb2
8 - Asteroid

How do I write an IF statement in the formula tool that says IF a field is not a whole number, then the message will read "..." in the new column?

7 REPLIES 7
ARussell34
8 - Asteroid

If your numbers are currently an integer, i.e. int32 or int64, use a select tool to change that column type of your number to a double.

If you have your number type as a double (decimals included) currently, then you could use a formula tool to say

If contains([number], ".") then "..."

else "whole"

endif

 

 

DataNath
17 - Castor
17 - Castor

Hey @richleeb2, there's an IsInteger() check within Alteryx that we can use here. I don't know what you wanted to output if the record is a whole number but I've just output the number itself in that case (you can obviously change this):

 

DataNath_0-1660851482498.png

Luke_C
17 - Castor
17 - Castor

Hi @richleeb2 

 

The IsInteger() function has you covered:

Luke_C_0-1660851569696.png

 

 

richleeb2
8 - Asteroid

This worked!  But how do I get it to ignore null values?

Luke_C
17 - Castor
17 - Castor

Hi @richleeb2 

 

From my testing my formula should already ignore null values, perhaps you can share what your expected results are in that case?

 

Luke_C_0-1660859974067.png

 

richleeb2
8 - Asteroid
ValueResult
null 
HiMust be a whole number
1.2Must be a whole number
3 
1.5Must be a whole number

 

So if the Value field is either blank, null or a whole number, then nothing should show in Result column.  Otherwise, I want it to show "Must be a whole number"

Luke_C
17 - Castor
17 - Castor

Hi @richleeb2 

 

Update the ... in my example to "Must be a whole number" and youll have what you need.

Labels
Top Solution Authors