Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenTue, 01 Sep 2020 12:06:06 +0200Modulus Function (Remainder after division)https://ask.libreoffice.org/en/question/141801/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 Fri, 29 Dec 2017 08:39:09 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/Comment by Lupp for <p>Hello.</p>
<p>I'm trying to figure out how to separate a whole number from the remainder.</p>
<p>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.</p>
<p>Is this possible?</p>
<p>Thank you,
-Chris </p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141819#post-id-141819Please 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.Fri, 29 Dec 2017 12:09:42 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141819#post-id-141819Answer by librebel for <p>Hello.</p>
<p>I'm trying to figure out how to separate a whole number from the remainder.</p>
<p>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.</p>
<p>Is this possible?</p>
<p>Thank you,
-Chris </p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?answer=141812#post-id-141812Hello @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, libFri, 29 Dec 2017 11:45:57 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?answer=141812#post-id-141812Comment by Robert K. for <p>Hello <a href="/en/users/43522/codewolf/">@codewolf</a>,</p>
<p>Suppose that your value 3.14 is located in cell A1,</p>
<p>To get the integral part ( =3 ) just put the following formula into cell B1:</p>
<p><code>= INT( A1 )</code></p>
<p>To get the decimal part ( =0.14 ) put the following formula into cell C1:</p>
<p><code>=A1 - INT( A1 )</code></p>
<p>HTH, lib</p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=263480#post-id-263480sorry, but this answer is wrong.
As above comment says correctly: `MOD()` is the proper function here!Tue, 01 Sep 2020 12:06:06 +0200https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=263480#post-id-263480Comment by Mike Kaganski for <p>Hello <a href="/en/users/43522/codewolf/">@codewolf</a>,</p>
<p>Suppose that your value 3.14 is located in cell A1,</p>
<p>To get the integral part ( =3 ) just put the following formula into cell B1:</p>
<p><code>= INT( A1 )</code></p>
<p>To get the decimal part ( =0.14 ) put the following formula into cell C1:</p>
<p><code>=A1 - INT( A1 )</code></p>
<p>HTH, lib</p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141821#post-id-141821IMO, the MOD is the proper solution, because it is not only solving the task, but also self-documenting and telling: `=MOD(A1;SIGN(A1))`Fri, 29 Dec 2017 12:13:43 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141821#post-id-141821Answer by robleyd for <p>Hello.</p>
<p>I'm trying to figure out how to separate a whole number from the remainder.</p>
<p>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.</p>
<p>Is this possible?</p>
<p>Thank you,
-Chris </p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?answer=141803#post-id-141803Look at the functions MOD and ROUND or ROUNDDOWNFri, 29 Dec 2017 10:29:21 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?answer=141803#post-id-141803Comment by RGB-es for <p>Look at the functions MOD and ROUND or ROUNDDOWN</p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141804#post-id-141804Also QUOTIENT:
`=QUOTIENT(20;3)`
gives `6`
`=MOD(20;3)`
gives `2`Fri, 29 Dec 2017 10:37:57 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141804#post-id-141804Comment by Lupp for <p>Look at the functions MOD and ROUND or ROUNDDOWN</p>
https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141815#post-id-141815In 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.Fri, 29 Dec 2017 12:00:13 +0100https://ask.libreoffice.org/en/question/141801/modulus-function-remainder-after-division/?comment=141815#post-id-141815