Test for Whole Number

N

Neil

I want to test product packaging and need to ensure data provided is
accurate. To do this I have two packages a "Master Pack" and and "Inner
Pack". If my Master Pack is 10 and my Inner Pack is 2 I know I have 5 Inner
Packs and the math works out. I'm good with that. What I want to do is test
for a situation where if my Master Pack is 12 and my Inner Pack is 5 I have
2.4 Inner Pack.

I can't have .4 of an Inner Pack. How do I test for .4 of an Inner Pack?
 
A

Allen Browne

Mod gives you the remainder after division, so you want to test if:
[MasterPack] Mod [InnerPack] = 0
 
T

Tom van Stiphout

On Thu, 28 Feb 2008 06:18:00 -0800, Neil

if Int(MasterPack/InnerPack) = MasterPack/InnerPack then
Msgbox "Yippee! Whole numbers!
end if

-Tom.
 
N

Neil

Thanks!

Allen Browne said:
Mod gives you the remainder after division, so you want to test if:
[MasterPack] Mod [InnerPack] = 0

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Neil said:
I want to test product packaging and need to ensure data provided is
accurate. To do this I have two packages a "Master Pack" and and "Inner
Pack". If my Master Pack is 10 and my Inner Pack is 2 I know I have 5
Inner
Packs and the math works out. I'm good with that. What I want to do is
test
for a situation where if my Master Pack is 12 and my Inner Pack is 5 I
have
2.4 Inner Pack.

I can't have .4 of an Inner Pack. How do I test for .4 of an Inner Pack?
 
Top