hibitor,

You are correct. I had to revise the formula I posted earlier. Here is a new one:

X%Y =

IF(Y>0) then X-(INT(X/Y)*Y),

IF(Y<0) then

IF(ABS(X)>=2*ABS(Y)) then X+SIGN(X*Y)*(FLOOR(ABS(X)/ABS(Y))*ABS(Y)

IF(ABS(X) < 2*ABS(Y)) then X+SIGN(X*Y)*(CEILING(ABS(X)/ABS(Y))*ABS(Y)

A few notes on the functions:

INT: Rounds a number down to the nearest integer

FLOOR: Rounds number down, toward zero, to the nearest integer

CEILING: Returns number rounded up, away from zero, to the nearest integer

ABS: Returns the absolute value of a number

SIGN: Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.

Here is the calculated results in Excel:

And here is the formula for use in excel if X is in A1 and Y is in B1:

Code:

`=IF(B1>0,A1-(INT(A1/B1)*B1),IF(B1<0,IF(ABS(A1)>2*ABS(B1),A1+SIGN(A1*B1)*(FLOOR(ABS(A1)/ABS(B1),1)*ABS(B1)),SIGN(A1*B1)*(CEILING(ABS(A1)/ABS(B1),1)*ABS(B1))+A1),0))`