We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Modulus Function (Remainder after division) [closed]

asked 2017-12-29 08:39:09 +0200

codewolf gravatar image


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 flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-10-25 12:25:38.437642



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.

Lupp gravatar imageLupp ( 2017-12-29 12:09:42 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2017-12-29 11:45:57 +0200

librebel gravatar image

updated 2017-12-29 11:46:28 +0200

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

edit flag offensive delete link more



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))

Mike Kaganski gravatar imageMike Kaganski ( 2017-12-29 12:13:43 +0200 )edit

sorry, but this answer is wrong. As above comment says correctly: MOD() is the proper function here!

Robert K. gravatar imageRobert K. ( 2020-09-01 12:06:06 +0200 )edit

answered 2017-12-29 10:29:21 +0200

robleyd gravatar image

Look at the functions MOD and ROUND or ROUNDDOWN

edit flag offensive delete link more




gives 6


gives 2

RGB-es gravatar imageRGB-es ( 2017-12-29 10:37:57 +0200 )edit

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.

Lupp gravatar imageLupp ( 2017-12-29 12:00:13 +0200 )edit

Question Tools

1 follower


Asked: 2017-12-29 08:39:09 +0200

Seen: 17,754 times

Last updated: Dec 29 '17