Doing a Divide Need The Whole Part Only...

M

Muse

Say I'm dividing 12/5 the answer is 2.4. I need access to return only 2 and
ignore the remainder. Is there a function that does this?
 
F

fredg

Say I'm dividing 12/5 the answer is 2.4. I need access to return only 2 and
ignore the remainder. Is there a function that does this?

Use Integer division (\).

?12/5
2.4
?12\5
2
 
M

Marshall Barton

Muse said:
Say I'm dividing 12/5 the answer is 2.4. I need access to return only 2 and
ignore the remainder. Is there a function that does this?


Try using the integer divide operator \

12 \ 5 the answer is 2
 
J

John Spencer MVP

You can use the INT function or the \ integer division operator if your
numbers are always whole numbers (no decimal portion).

Int(12/5) and 12\5 will both return 2

HOWEVER, if your numbers can contain decimal portions then you need to be
aware that Int and integer division can return different results. For instance

?11.41\5.7 Returns 1
?11.41/5.7 returns 2.00175438596491
?Int(11.41/5.7) returns 2


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top