Mod function

G

Guest

The VBA "x Mod y" function and the Excel function =Mod(x,y) produce
consistent results when both parameters are positive. When the number, x, is
negative, these two functions produce different results.
For example the VBA function returns
- 1 = -1 Mod 3
and
the Excel function returns
2 = Mod(-1, 3)

I agree with the Excel function's results.

Anyone have any idea why these functions would have different results?
 

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