How to separate number by its decimal point in Excel/Calc?
Solution 1:
TRUNC()
is designed to remove the decimal part of any number immediately and without any modification to the non-decimal part.
So, as per LinYan's answer, you just need to use:
-
TRUNC(A1)
to obtain the integer part of the value inA1
-
A1-TRUNC(A1)
to obtain the fractional part of the value inA1
Unlike FLOOR()
, TRUNC()
works on both positive and negative numbers without requiring adjustment, and works in the same way in both Microsoft Excel and LibreOffice.
FLOOR()
requires the significance parameter to have the same sign as the number being processed (or else will throw an error), so the 1
at the end would have to be changed to -1
to process negative numbers, or you could insert SIGN()
and unnecessarily complicate the formula further.
And, in OpenOffice and LibreOffice, FLOOR()
also has an additional (compared to Excel) third "mode" parameter that changes the results that the function returns for negative numbers.
Solution 2:
you can try FLOOR
function, floor(A1,1)
for integer part of A1, A1-floor(A1,1)
for decimal part of A1.