# Modulus Function (Remainder after division)

Hello.

I'm trying to figure out how to separate a whole number from the remainder.

For example, after and equation I get (3.14). I'd like the 3 in one column and the .14 to be saved in another so I can carry it to the next calculation.

Is this possible?

Thank you, -Chris

edit retag close merge delete

1

Please note that numerical contents and results (numbers) may also be negative.
You will have to decide explicitly if you want -3.14 to be split into (-3|-0.14) or (-4|+0.86).
The suggestion by @librebel will return the second pair.

Sort by » oldest newest most voted Hello @codewolf,

Suppose that your value 3.14 is located in cell A1,

To get the integral part ( =3 ) just put the following formula into cell B1:

= INT( A1 )

To get the decimal part ( =0.14 ) put the following formula into cell C1:

=A1 - INT( A1 )

HTH, lib

more

2

IMO, the MOD is the proper solution, because it is not only solving the task, but also self-documenting and telling: =MOD(A1;SIGN(A1)) Look at the functions MOD and ROUND or ROUNDDOWN

more

Also QUOTIENT:

=QUOTIENT(20;3)

gives 6

=MOD(20;3)

gives 2

1

In fact MOD(Dividend;Divisor) also accepts negative numbers and non-integers.
It is defined generally as
MOD(Dividend;Divisor) = Divisor - INT(Dividend/Divisor)*Divisor
where the INT(Dividend/Divisor) differs from QUOTIENT(Dividend;Divisor) if the two arguments have different signs.