Formula to check if value is an integer

Hi,

I am doing a calculation of the inventory divided by the standard packaging.
Now I want to create a formula to check if the calculated object is an integer number or not.

Example:
2500 inventory – packaging qty: 500 pcs – result is 5
2500 inventory – packaging qty: 400 pcs – result is 6.25

Now I want to combine it with an if formula and if the result is an integer, then calculate something…

How do I check if a value is an integer number? Is there something available like the function “even”?

Thanks
Flooo


Flooo (BOB member since 2013-01-23)

Does the Mod() function help?


Nick Daniels :uk: (BOB member since 2002-08-15)

Hi Flooo,

Will a formula like this work?

If [your number] = Floor([your number]) Then "Integer" Else "Noninteger"

Marek Chladny :slovakia: (BOB member since 2003-11-27)

hi both,

thanks a lot for your feedback.

@ Marek, your proposal works fine in most of the cases.
Unfortunately there are a few items which are not correct, like:
inventory 7000, packaging quantity is 1000 and the result is 7 - unfortunately as Noninteger.

What could be the reason for it and how can I solve it?

Thanks
Flooo


Flooo (BOB member since 2013-01-23)

Just a guess:
Maybe either inventory (7000) or packaging quantity (1000) number is not an integer even though it’s formatted/displayed in a table as an integer. Then their division is not an integer either.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Or there might be a very slight discrepancy introduced as a result of the arithmetic. Could you check whether the difference between your number and the floor is very small, say within .0001 (plus or minus) ?


mikeil (BOB member since 2015-02-18)

Hi both,

thanks for your further response. today I just refreshed the report and now its working. Not sure of the root cause.
In case it pops up again, I need to investigate it further.

Thanks again.

Flooo


Flooo (BOB member since 2013-01-23)