MOD and QUOTIENT Functions

D

DuetSong

I want to use MOD( ) and QUOTIENT ( ) functions in a query in Access 2002.
But these are not available (although these are available in Excel 2002). Any
suggestions what to do?
 
D

Douglas J. Steele

Mod exists in Access, it's just that its syntax is a little different. In
Excel, you'd use Mod(M, N), in Access, you use M Mod N

There is no Quotient function in Access, but since all it does is return the
integer result of the division, it's pretty easy to simulate using the Fix
function. Instead of Quotient(M, N), use Fix(M/N)
 
K

Klatuu

Another way to return just the integer portion of a division is to use the \
operator. It returns the integer value of a division

5/3 = 1.66666666666667
5\3 = 1
 
J

John Spencer

Careful. Different results using Fix versus Integer division.

?5.6/2.25 = 2.48888888888889

?5.6\2.25 = 3

?Fix(5.6/2.25) = 2

I **believe** integer division rounds the numbers involved to integers,
then does the division and then rounds the number to an integer
 
D

DuetSong

thanks john, klatuu, Douglas. I was able to work it out with your helpful
hints.
 
Top