Thread: Mod operator
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default Mod operator

Some implementations of MOD work differently when the arguments have different
signs. The worksheet function uses the definition that the modulus is always
positive, i.e. =MOD(-10,3) yields -4 with a remainder of 2. OTOH, in VBA,
definition that's used is probably what you division in grade school: -10
divided by +3 is -3 with a remainder of -1.


On Wed, 01 Sep 2004 10:08:40 -0400, R Avery wrote:

How come the Mod operator can return negative values? I've always
wondered why.